簡體   English   中英

“ rails new”命令出錯(使用rbenv)

[英]Error on “rails new” command (using rbenv)

我已經安裝了rbenv,ruby和rails,但是創建新的rails項目的命令導致sqlite出現異常。

rails new first_app
.
.
.
Using sass (3.2.3) 
Using sass-rails (3.2.5) 
Installing sqlite3 (1.3.6) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/alundgren/.rbenv/versions/1.9.3-p327/bin/ruby 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=/home/alundgren/.rbenv/versions/1.9.3-p327/bin/ruby
    --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/alundgren/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/alundgren/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.

我試過安裝sqlite gem並重新哈希rbenv ,但是同樣的錯誤。 有人對如何解決此問題,確切的寶石名稱等有任何想法嗎?

我遇到了同樣的問題,並在ubuntu上安裝了sqlite軟件包:

apt-get install libsqlite3-dev

問題是您缺少編譯mysql適配器所需的頭文件。 該錯誤提示“嘗試'port install sqlite3 + universal'或'yum install sqlite-devel'並檢查您的共享庫搜索路徑(您的sqlite3共享庫所在的位置)”。 我會首先這樣做,因為這將確保您的計算機上具有正確的頭文件。 擁有它們之后,可能必須為編譯器指定文件的位置,“-with-sqlite3-include”指令可能會解決問題。

您的盒子上似乎沒有安裝sqlite 如果沒有底層,則不會安裝gem。

請執行以下操作:

  • macosx: brew install sqlite
  • 企業linux: sudo yum install libsqlite3-dev
  • ubuntu: sudo apt-get install libsqlite3-dev

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM