Ruby On Rails创建新项目时出现SQLite错误

时间:2021-03-28 05:32:07

I've been working with ruby recently, I really like the language and have been picking it up really quick I decided it was time to try and work with the Rails framework. When I try to create a new project my typing

我最近一直在和ruby一起工作,我非常喜欢这种语言并且很快就把它拿起来我觉得是时候尝试使用Rails框架了。当我尝试创建一个新项目时,我打字

rails new first-site

I get the following errors I've spent hours Googling it and haven't found any similar result

我得到以下错误我花了几个小时谷歌搜索它并没有找到任何类似的结果

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.

I then run the gem install sqlite3 -v '1.3.8' and get similar errors. I have no idea what I'm doing wrong.

然后我运行gem install sqlite3 -v'1.3.8'并得到类似的错误。我不知道我做错了什么。

2 个解决方案

#1


0  

Looks like you need to install sqlite

看起来你需要安装sqlite

That is where the

那就是

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

If you have another db setup like postgres you can run it with the database switch

如果你有像postgres这样的另一个db设置,你可以使用数据库开关运行它

rails new myapp --database=postgresql

#2


0  

I found out I was missing developer dependencies when trying to use the MySQL gem. All is fixed now :)

我发现在尝试使用MySQL gem时我缺少开发人员依赖项。一切都修复了:)

#1


0  

Looks like you need to install sqlite

看起来你需要安装sqlite

That is where the

那就是

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

If you have another db setup like postgres you can run it with the database switch

如果你有像postgres这样的另一个db设置,你可以使用数据库开关运行它

rails new myapp --database=postgresql

#2


0  

I found out I was missing developer dependencies when trying to use the MySQL gem. All is fixed now :)

我发现在尝试使用MySQL gem时我缺少开发人员依赖项。一切都修复了:)