我刚开始学习Ruby on Rails,学习了一些教程。 Rails一直运作良好,直到有一天它才停止工作。以下代码是我尝试运行rails时从终端获得的代码:
$ rails -v
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
WARN: Unresolved specs during Gem::Specification.reset:
i18n (>= 0.6.9, ~> 0.6)
json (>= 1.7.7, ~> 1.7)
tzinfo (~> 1.1)
minitest (~> 5.1)
thread_safe (~> 0.1)
rake (>= 0.8.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Could not find sqlite3-1.3.9 in any of the sources
Run `bundle install` to install missing gems.
所以我运行了bundle install和gem install sqlite3-1.3.9,但它们都没有工作。当我运行gem install sqlite3-1.3.9时,以下代码来自终端:
$ sudo gem install sqlite3 -v '1.3.9'
Password:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
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.
但是当我尝试安装sqlite3 + universal'时,安装sqlite-devel' yum install sqlite-devel'并且' apt-get install libsqlite3-dev',终端显示:
$ apt-get install libsqlite3-dev
-bash: apt-get: command not found
即使是yum和port也找不到命令。有人说我应该安装ruby-dev软件包,也可能安装libsqlite3-dev(Ubuntu)或sqlite-devel(Fedora)软件包,但我不知道怎么做。我该怎么办?我应该重新安装Ruby和Rails吗?非常感谢!!!