Rails 找不到已安装的 gem
Rails can't find installed gem
我正在学习 Rails 的教程,该教程专门要求版本 4.2.0
,因此我安装了 Rails 和 sudo gem install rails -v 4.2.0
,并且运行良好。当我尝试使用 rails _4.2.0 new test_app
创建一个新应用程序时,我收到一条错误消息,内容为 /Library/Ruby/Site/2.0.0/rubygems/dependency.rb.315: in 'to_specs': Could not find 'railties' (=4.2.0) - did find: [railties-4.2.1] (Gem::LoadError)
并继续进行更多操作。
我已经尝试使用 sudo gem install railties -v 4.2.0
安装特定版本的 railties
,但我仍然遇到相同的错误。它是否在两个不同的地方检查 for/installing 和 gem?
编辑:运行 gem list
产生以下输出,清楚地显示 railties (4.2.0)
:
*** LOCAL GEMS ***
actionmailer (4.2.0)
actionpack (4.2.1, 4.2.0)
actionview (4.2.1, 4.2.0)
activejob (4.2.1, 4.2.0)
activemodel (4.2.0)
activerecord (4.2.0)
activesupport (4.2.1, 4.2.0)
arel (6.0.0)
bigdecimal (1.2.6)
builder (3.2.2)
bundler (1.9.9)
erubis (2.7.0)
globalid (0.3.5)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.2, 1.8.1)
loofah (2.0.2)
mail (2.6.3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.6.1, 5.4.3)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.8)
rack (1.6.1)
rack-test (0.6.3)
rails (4.2.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.0)
rake (10.4.2)
rdoc (4.2.0)
sprockets (3.1.0)
sprockets-rails (2.3.1)
test-unit (3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
您不应该使用 sudo 来安装 gem。使用 rbenv.
我正在学习 Rails 的教程,该教程专门要求版本 4.2.0
,因此我安装了 Rails 和 sudo gem install rails -v 4.2.0
,并且运行良好。当我尝试使用 rails _4.2.0 new test_app
创建一个新应用程序时,我收到一条错误消息,内容为 /Library/Ruby/Site/2.0.0/rubygems/dependency.rb.315: in 'to_specs': Could not find 'railties' (=4.2.0) - did find: [railties-4.2.1] (Gem::LoadError)
并继续进行更多操作。
我已经尝试使用 sudo gem install railties -v 4.2.0
安装特定版本的 railties
,但我仍然遇到相同的错误。它是否在两个不同的地方检查 for/installing 和 gem?
编辑:运行 gem list
产生以下输出,清楚地显示 railties (4.2.0)
:
*** LOCAL GEMS ***
actionmailer (4.2.0)
actionpack (4.2.1, 4.2.0)
actionview (4.2.1, 4.2.0)
activejob (4.2.1, 4.2.0)
activemodel (4.2.0)
activerecord (4.2.0)
activesupport (4.2.1, 4.2.0)
arel (6.0.0)
bigdecimal (1.2.6)
builder (3.2.2)
bundler (1.9.9)
erubis (2.7.0)
globalid (0.3.5)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.2, 1.8.1)
loofah (2.0.2)
mail (2.6.3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.6.1, 5.4.3)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.8)
rack (1.6.1)
rack-test (0.6.3)
rails (4.2.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.0)
rake (10.4.2)
rdoc (4.2.0)
sprockets (3.1.0)
sprockets-rails (2.3.1)
test-unit (3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
您不应该使用 sudo 来安装 gem。使用 rbenv.