我最近一直在使用ruby,我非常喜欢这种语言并且很快就开始使用它我觉得是时候尝试使用Rails框架了。当我尝试创建一个新项目时,我打字
rails new first-site
我得到以下错误我花了几个小时谷歌搜索它并且没有找到任何类似的结果
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'并得到类似的错误。 我不知道我做错了什么。
答案 0 :(得分:0)
看起来你需要安装sqlite
那就是
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel'
如果您有另一个像postgres这样的数据库设置,可以使用数据库开关
运行它rails new myapp --database=postgresql
答案 1 :(得分:0)
我发现在尝试使用MySQL gem时我缺少开发人员依赖项。现在一切都已修好:)