簡體   English   中英

創建新項目時出現Ruby On Rails SQLite錯誤

[英]Ruby On Rails SQLite errors when creating new project

我最近一直在使用ruby,我真的很喜歡這種語言,並且很快就開始使用它,我認為是時候嘗試使用Rails框架了。 當我嘗試創建一個新項目時,我的打字

rails new first-site

我花了幾個小時在Google上搜索了以下錯誤,但未發現任何類似結果

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

    /usr/local/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=/usr/local/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}/
--enable-local
--disable-local


Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/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.

然后,我運行gem install sqlite3 -v'1.3.8'並得到類似的錯誤。 我不知道我在做什么錯。

看起來您需要安裝sqlite

那就是

sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel'

如果您有其他數據庫設置(如postgres),則可以使用數據庫開關運行它

rails new myapp --database=postgresql

我發現嘗試使用MySQL gem時缺少開發人員依賴項。 現在所有問題都已解決:)

暫無
暫無

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

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