简体   繁体   English

命令行gem安装错误-sqlite3-Rails新命令

[英]Command line gem install error - sqlite3 - Rails New Command

I tried creating a new rails application in command line and had the following error. 我尝试在命令行中创建新的Rails应用程序,并遇到以下错误。 What's the problem? 有什么问题?

I have tried working it out myself, but I'm new to coding and even reading through it I'm completely lost! 我已经尝试过自己解决问题,但是我是编码的新手,即使阅读它,我也完全迷失了!

 /Users/johnsway/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
    checking for sqlite3.h... *** 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=/Users/johnsway/.rvm/rubies/ruby-2.1.2/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
/Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
    from extconf.rb:30:in `<main>'

extconf failed, exit code 1

If you need anything else, please feel free to ask! 如果您还有其他需要,请随时询问!

Thank you for your help! 谢谢您的帮助!

Perhaps this problem has to do with a recent update of XCode. 也许这个问题与XCode的最新更新有关。 After a XCode update you need to do the following steps: 更新XCode之后,您需要执行以下步骤:

  1. Open Xcode and accept the license agreement 打开Xcode并接受许可协议
  2. Reinstall the Command Line Tools. 重新安装命令行工具。

The second step seems to depend on your OS versions. 第二步似乎取决于您的操作系统版本。 If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices . 如果xcode-select --install不起作用,请尝试在/System/Library/CoreServices启动“ Install Command Line Developer Tools应用程序。

After reinstalling the Command Line Tools try to rerun bundle install . 重新安装命令行工具后,尝试重新运行bundle install

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

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