简体   繁体   English

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

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

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. 我最近一直在使用ruby,我真的很喜欢这种语言,并且很快就开始使用它,我认为是时候尝试使用Rails框架了。 When I try to create a new project my typing 当我尝试创建一个新项目时,我的打字

rails new first-site

I get the following errors I've spent hours Googling it and haven't found any similar result 我花了几个小时在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.

I then run the gem install sqlite3 -v '1.3.8' and get similar errors. 然后,我运行gem install sqlite3 -v'1.3.8'并得到类似的错误。 I have no idea what I'm doing wrong. 我不知道我在做什么错。

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),则可以使用数据库开关运行它

rails new myapp --database=postgresql

I found out I was missing developer dependencies when trying to use the MySQL gem. 我发现尝试使用MySQL gem时缺少开发人员依赖项。 All is fixed now :) 现在所有问题都已解决:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM