2013-05-11 96 views
1

我在嘗試設置Ruby on Rails網站時出現錯誤。我以前從未使用過Ruby,因此安裝程序中的所有內容都是乾淨的。在rails上設置ruby時出現Gem安裝程序錯誤(Windows 7)

我已經安裝了Ruby 1.9.3和RubyGems 2.0.3。然後,我使用gem安裝了導軌,並使用rails new創建了一個空白站點。在某個時候,我還按照說明安裝了DevKit here - 我不記得具體時間,但我在某個時候被明確要求。然後我嘗試使用rails server來啓動它,但它要求我使用bundle install來安裝一些缺失的寶石。很容易,但是當我嘗試,我得到以下輸出:

Fetching gem metadata from https://rubygems.org/........... 
Fetching gem metadata from https://rubygems.org/.. 
Resolving dependencies... 
Using rake (10.0.4) 
Using i18n (0.6.1) 
Using multi_json (1.7.3) 
Using activesupport (3.2.13) 
Using builder (3.0.4) 
Using activemodel (3.2.13) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.2) 
Using tilt (1.4.1) 
Using sprockets (2.2.2) 
Using actionpack (3.2.13) 
Using mime-types (1.23) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.5.3) 
Using actionmailer (3.2.13) 
Using arel (3.0.2) 
Using tzinfo (0.3.37) 
Using activerecord (3.2.13) 
Using activeresource (3.2.13) 
Using bundler (1.3.5) 
Using coffee-script-source (1.6.2) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Installing json (1.7.7) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    "C:/Ruby/Ruby 1.9.3/bin/ruby.exe" extconf.rb 
C:/Ruby/Ruby 1.9.3/bin/ruby.exe: invalid option -1 (-h will show valid options) (RuntimeError) 


Gem files will remain installed in C:/Ruby/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.7 for inspection. 
Results logged to C:/Ruby/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out 
An error occurred while installing json (1.7.7), and Bundler cannot continue. 
Make sure that `gem install json -v '1.7.7'` succeeds before bundling. 

我運行的是gem install json -v '1.7.7'或只是gem install json時,得到同樣的錯誤。這個特殊的錯誤已經證明它本身對谷歌搜索有抵抗力,所以我想我會試着在這裏問。任何幫助,將不勝感激!

+0

你有沒有試過'gem update --system'(發現在http://stackoverflow.com/questions/7780756/cannot-install-json-gem-in-rails-using-windows)? – Baldrick 2013-05-11 15:11:09

+0

嘗試通過平臺:'gem install json --platform = ruby​​'。另一個很好的來源:https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun – Mindbreaker 2013-05-11 15:22:55

+0

@Baldrick:是的,我發現或之前類似的東西 - 一切都已經是最新的。 – reavowed 2013-05-11 16:30:06

回答

2

嗯,事實證明問題是我的Ruby安裝路徑中有空格。這在很多地方顯然被強烈推薦,但錯誤信息是不相關的,我花了一段時間才把兩個和兩個放在一起。

相關問題