2012-11-17 103 views
1

我在嘗試rake db:migrate時遇到問題。我得到以下錯誤:ubuntu上的json問題12.04

Could not find json-1.7.5 in any of the sources 
Run `bundle install` to install missing gems. 

現在,我已經運行bundle install,它給了一個錯誤,當它得到JSON,但我再次嘗試也無妨,並得到同樣的錯誤當它到達JSON:

Installing json (1.7.5) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot 

load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from extconf.rb:1:in '

Gem files will remain installed in /home/chris/.bundler/tmp/2984/gems/json-1.7.5 for inspection. Results logged to /home/chris/.bundler/tmp/2984/gems/json-1.7.5/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.7.5), and Bundler cannot continue. Make sure that gem install json -v '1.7.5' succeeds before bundling.

最後一部分說,確保gem install json -v '1.7.5'綁定前的成功,所以我運行這個命令和JSON精細安裝:

Building native extensions. This could take a while...
Successfully installed json-1.7.5
1 gem installed
Installing ri documentation for json-1.7.5...
Installing RDoc documentation for json-1.7.5...

但如果我嘗試rake db:migrate它ST藝術再次出現同樣的錯誤。我已經閱讀了有關Mac上的json的問題,但沒有任何解決方案的運氣。有任何想法嗎?

我運行Ubuntu 12.04LTS,紅寶石1.9.3,軌3.2.8,寶石1.8.15

+0

http://stackoverflow.com/questions/11058952/why-do-i-get-an-error-installing-the-json-gem-in-ubuntu – uday

回答

1

我認爲你需要安裝-dev包(用1.9.1也嘗試過)。嘗試運行此命令

sudo aptitude install ruby1.9.1-dev 

然後bundle install應該工作。

+0

謝謝avk。這工作。在尋找解決方案時,我看到一些討論安裝DevKit的線程,但那是針對Windows的Ruby Installer。我想知道爲什麼我無法在其他地方找到您的解決方案......似乎很簡單。 rubyonrails.org上的rails導航指南,Hansson的Rails的敏捷Web開發書籍也沒有提到這一點,至少我沒有在任何地方看到它。再次感謝。 – cliff900

+0

歡迎您!我有一個類似的問題回來,很奇怪,但很好,它有一個解決方案:D – avk

+0

我應該補充的唯一的事情是,我用apt-get而不是aptitude,因爲那是我認爲是默認的。我是Linux的新手,所以我對其他選擇瞭解得不多。 – cliff900