2012-04-12 128 views
6

我使用Windows,我剛剛運行的命令:Ruby on Rails的 - 無法安裝SystemTimer

C:\Sites\cmply>gem install SystemTimer -v '1.2.3' 

,我得到這個錯誤:

Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
ERROR: Error installing SystemTimer: 
     ERROR: Failed to build gem native extension. 

     C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb 
creating Makefile 

make 
generating system_timer_native-i386-mingw32.def 
compiling system_timer_native.c 
In file included from system_timer_native.c:8:0: 
c:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete 
system_timer_native.c: In function 'install_first_timer_and_save_original_configuration': 

任何想法,爲什麼?在此之前,我有另外一個可疑的錯誤:

Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/SystemTimer-1.2.3 for inspection. 
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/SystemTimer-1.2.3/ext/system_timer/gem_make.out 
An error occured while installing SystemTimer (1.2.3), and Bundler cannot continue. 
Make sure that `gem install SystemTimer -v '1.2.3'` succeeds before bundling. 

在此之前,我得到的似乎表明,我的Ruby版本是有點不同步的另一個錯誤:

C:\Sites\cmply>bundle update rake 
Updating git://github.com/twitter/twitter-text-rb.git 
Fetching source index for http://rubygems.org/ 
Bundler could not find compatible versions for gem "activesupport": 
    In snapshot (Gemfile.lock): 
    activesupport (3.2.3) 

    In Gemfile: 
    rails (= 3.1.3) x86-mingw32 depends on 
     activesupport (= 3.1.3) x86-mingw32 

Running `bundle update` will rebuild your snapshot from scratch, using only 
the gems in your Gemfile, which may resolve the conflict. 

因此,它是根源於在我有一個不兼容的紅寶石版本?這應該如何解決?

謝謝!

+0

Ruby有其默認的'Time'類。爲什麼你需要另一個寶石? – uday 2012-04-12 15:09:40

+0

你能提供你的Ruby版本嗎? 'ruby -v'命令的輸出。 – 2012-04-12 15:21:09

+0

@uDaY'SystemTimer'不等同於'Time'類,它是一塊完全不同的東西。 – 2012-04-12 15:21:51

回答

3

檢查輸出它說你正在構建Ruby 1.9.3的包含文件1.9.1。

它看起來像你的Ruby安裝不知何故被破壞。我會嘗試重新安裝Ruby 1.9.3並檢查包含文件是否存在於c:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.3/中,而不是在c:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/中。

19

你不能用ruby 1.9安裝system_timer gem,但它不是一個bug,它是一個功能。這裏是full explanation

"system_timer is only relevant if you are running Ruby 1.8. You do not need it if you are running Ruby 1.9"

如果您要從Ruby 1.8切換到1.9,只需刪除system_time gem並更新處理超時的代碼即可。