2013-09-26 30 views
3

我開始檢查,該版本是適當的,檢查我的系統是否符合最低要求後: rails new app 當零新的應用程序,我得到的消息NEXT:啓動軌道,sqlite3的錯誤

  run bundle install 
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/ui.rb:36:in `initialize': undefined method `[]' for #<Thor::Shell::Color:0x95890e0> (NoMethodError) 
    from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `new' 
    from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `initialize' 
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `new' 
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `dispatch' 
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:386:in `start' 
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `block in <main>' 
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors' 
    from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `<main>' 

進入新創建的Rails應用程序。我跑bundle install隨即開始安裝,並收到以下錯誤信息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /usr/bin/ruby1.9.1 extconf.rb 
checking for sqlite3.h... no 
sqlite3.h is missing. Try 'port install sqlite3 +universal' 
or 'yum install sqlite-devel' and check your shared library search path (the 
location where your sqlite3 shared library is located). 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/ruby1.9.1 
    --with-sqlite3-dir 
    --without-sqlite3-dir 
    --with-sqlite3-include 
    --without-sqlite3-include=${sqlite3-dir}/include 
    --with-sqlite3-lib 
    --without-sqlite3-lib=${sqlite3-dir}/lib 
    --enable-local 
    --disable-local 


Gem files will remain installed in /home/helio/.bundler/tmp/23089/gems/sqlite3-1.3.8 for inspection. 
Results logged to /home/helio/.bundler/tmp/23089/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out 

An error occurred while installing sqlite3 (1.3.8), and Bundler 
cannot continue. 
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before 
bundling. 

我試過,但是當我嘗試安裝splite3我得到一個錯誤信息:

Building native extensions. This could take a while... 
ERROR: Error installing sqlite3: 
    ERROR: Failed to build gem native extension. 

     /usr/bin/ruby1.9.1 extconf.rb 
checking for sqlite3.h... no 
sqlite3.h is missing. Try 'port install sqlite3 +universal' 
or 'yum install sqlite-devel' and check your shared library search path (the 
location where your sqlite3 shared library is located). 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/ruby1.9.1 
    --with-sqlite3-dir 
    --without-sqlite3-dir 
    --with-sqlite3-include 
    --without-sqlite3-include=${sqlite3-dir}/include 
    --with-sqlite3-lib 
    --without-sqlite3-lib=${sqlite3-dir}/lib 
    --enable-local 
    --disable-local 


Gem files will remain installed in /var/lib/gems/1.9.1/gems/sqlite3-1.3.8 for inspection. 
Results logged to /var/lib/gems/1.9.1/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out 
+0

我也試着寫兩條建議消息的線路:'端口安裝sqlite3 +通用'和'yum安裝sqlite-devel'和沒有什麼不工作。 – Hell0

回答

0

問題出在Gemfile中。本教程中有一個提示:Windows和Mac默認安裝了Java運行時腳本。相反,linux不承載它。它必須單獨安裝。但它很容易解決 首先是在Gemfile中清除引用運行時的行。 第二個是bundle install。 Bundler運行這個命令安裝必要的軟件和boala,解決了。

1

您需要首先在你的系統上安裝sqlite3。 Rails缺少這裏的庫。

+0

剛剛編輯條目後,試圖安裝sqlite3 – Hell0

+0

sqlite3被安裝SQLite版本3.7.13 2012-06-11 02:05:22 輸入「.help」的指令 輸入以「;」結尾的SQL語句。 「 sqlite>' – Hell0

7

我有同樣的錯誤,試圖啓動一個新的Rails項目。在這種情況下,sqlite3.h is missing,意味着缺少libsqlite3-dev,我想(我是Ubuntu和Sqlite3的新手)。答案可以在這裏找到:Installing sqlite headers

~$ sudo apt-get install sqlite3 
~$ sudo apt-get install libsqlite3-dev 
~$ bundle install 

之後,rails server爲我工作得很好。本地主機上有我的歡迎登陸

1

對我來說,我得到了錯誤(在MacOS上),結果是一個缺失的GNU MP庫。

這是在〜/ .rvm /寶石/紅寶石2.1.3 /擴展/ x86_64的-達爾文-13/2.1.0靜電/ sqlite3-1.3.9/mkmf.log文件中提及

-lgmp失蹤

沖泡顯示庫爲現有的,但我認爲Xcode的想知道:

我的蹤跡......

$釀造安裝GMP 警告:GMP-6.0.0a已安裝 ✔〜/ .rvm/gems/ruby​​-2.1.3/extensions/x86_64-darwin-1 3/2.1.0靜電/ sqlite3-1.3.9

$釀造安裝gmp4 警告:gmp4-4.3.2已經安裝 ✔〜/ .rvm /寶石/紅寶石2.1.3 /擴展/ x86_64- darwin-13/2.1.0-static/sqlite3-1.3.9

$ ls -altd/usr/local/lib/libgmp * lrwxr-xr-x 1 si staff 40 Jul 31 15:48/usr/local/lib/libgmp.10.dylib - > ../Cellar/gmp/6.0.0a/lib/libgmp.10.dylib lrwxr-xr-x 1 si staff 33 Jul 31 15:48/usr/local/lib /libgmp.a - > ../Cellar/gmp/6.0.0a/lib/libgmp.a lrwxr-xr-x 1 si staff 37 Jul 31 15:48 /usr/local/lib/libgmp.dylib - >。 ./Cellar/gmp/6.0.0a/lib/libgmp。dylib lrwxr-xr-x 1 si staff 41 Jul 31 15:48 /usr/local/lib/libgmpxx.4.dylib - > ../Cellar/gmp/6.0.0a/lib/libgmpxx.4.dylib lrwxr -xr-x 1 si staff 35 Jul 31 15:48 /usr/local/lib/libgmpxx.a - > ../Cellar/gmp/6.0.0a/lib/libgmpxx.a lrwxr-xr-x 1 si staff 39 Jul 31 15:48 /usr/local/lib/libgmpxx.dylib - > ../Cellar/gmp/6.0.0a/lib/libgmpxx.dylib ✔〜/ .rvm/gems/ruby​​-2.1.3/extensions /x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9

$ otool -L /usr/local/lib/libgmpxx.dylib /usr/local/lib/libgmpxx.dylib: /usr/local/lib/libgmpxx.4.dylib(兼容性版本9.0.0,當前版本9.0.0) /usr/local/Cellar/gmp/6.0.0a/lib/libgmp.10.dylib(兼容性版本13.0。 0 ,當前版本13.0.0) /usr/lib/libc++.1.dylib(兼容性版本1.0.0,當前版本120.0.0) /usr/lib/libSystem.B.dylib(兼容性版本1.0.0,當前版本版本1197.1.1) ✔〜/ .rvm/gems/ruby​​-2.1.3/extensions/x86_64-darwin -13/2.1.0-static/sqlite3-1.3.9

$ gem install sqlite3'1.3。 9' 構建原生擴展。這可能需要一段時間... 成功安裝sqlite3-1.3.9 錯誤:無法找到有效的寶石「1.3.9」(> = 0)中的任何存儲庫安裝 1寶石

即使它給這個錯誤消息,它似乎仍然安裝好