【问题标题】:Rails Console cannot find activesupport-4.1.2 even though it is installedRails 控制台即使安装也找不到 activesupport-4.1.2
【发布时间】:2014-06-30 17:02:33
【问题描述】:

当我运行 Rails 4.1.2 服务器时,我没有收到任何错误。

但是,如果我运行“rails c”,我会收到以下错误:

Could not find activesupport-4.1.2 in any of the sources
Run `bundle install` to install missing gems.

奇怪的是,activesupport-4.1.2 既安装了,又在 Gemfile.lock 中指定。我已经尝试过“捆绑更新”以及删除 Gemfile.lock 并运行“捆绑安装”。我也尝试在我的 Rails gemfile 中指定特定版本的 ActiveSupport,但是这让我无处可去。

我真的很想使用最新的 Rails,但我不能使用控制台似乎很糟糕。

FIY:我在带有 RVM 的 Linux 中使用 Ruby 2.1.2p95。

编辑:我卸载了所有 activesupport gem 并重新安装了 4.1.2。以下是“gem list activesupport 所说的”:

*** LOCAL GEMS ***

activesupport (4.1.2)

同样的问题。

EDIT2:这是我的 Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.2)
      actionpack (= 4.1.2)
      actionview (= 4.1.2)
      mail (~> 2.5.4)
    actionpack (4.1.2)
      actionview (= 4.1.2)
      activesupport (= 4.1.2)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.2)
      activesupport (= 4.1.2)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.2)
      activesupport (= 4.1.2)
      builder (~> 3.1)
    activerecord (4.1.2)
      activemodel (= 4.1.2)
      activesupport (= 4.1.2)
      arel (~> 5.0.0)
    activesupport (4.1.2)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    akami (1.2.2)
      gyoku (>= 0.4.0)
      nokogiri
    arel (5.0.1.20140414130214)
    builder (3.2.2)
    capybara (2.3.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.7.0)
    database_cleaner (1.3.0)
    diff-lcs (1.2.5)
    erubis (2.7.0)
    execjs (2.2.1)
    gyoku (1.1.1)
      builder (>= 2.1.2)
    hike (1.2.3)
    httpi (2.1.0)
      rack
      rubyntlm (~> 0.3.2)
    i18n (0.6.9)
    jbuilder (2.1.1)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    kgio (2.9.2)
    libv8 (3.16.14.3)
    macaddr (1.7.1)
      systemu (~> 2.6.2)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    mini_portile (0.6.0)
    minitest (5.3.5)
    multi_json (1.10.1)
    mysql2 (0.3.16)
    nokogiri (1.6.2.1)
      mini_portile (= 0.6.0)
    nori (2.4.0)
    polyglot (0.3.5)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.2)
      actionmailer (= 4.1.2)
      actionpack (= 4.1.2)
      actionview (= 4.1.2)
      activemodel (= 4.1.2)
      activerecord (= 4.1.2)
      activesupport (= 4.1.2)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.2)
      sprockets-rails (~> 2.0)
    railties (4.1.2)
      actionpack (= 4.1.2)
      activesupport (= 4.1.2)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    raindrops (0.13.0)
    rake (10.3.2)
    rdoc (4.1.1)
      json (~> 1.4)
    ref (1.0.5)
    rspec-core (3.0.2)
      rspec-support (~> 3.0.0)
    rspec-expectations (3.0.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.0.0)
    rspec-mocks (3.0.2)
      rspec-support (~> 3.0.0)
    rspec-rails (3.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.0.0)
      rspec-expectations (~> 3.0.0)
      rspec-mocks (~> 3.0.0)
      rspec-support (~> 3.0.0)
    rspec-support (3.0.2)
    rubyntlm (0.3.4)
    sass (3.2.19)
    sass-rails (4.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.0)
      sprockets (~> 2.8, <= 2.11.0)
      sprockets-rails (~> 2.0)
    savon (2.5.1)
      akami (~> 1.2.0)
      builder (>= 2.1.2)
      gyoku (~> 1.1.0)
      httpi (~> 2.1.0)
      nokogiri (>= 1.4.0)
      nori (~> 2.4.0)
      uuid (~> 2.3.7)
      wasabi (~> 3.3.0)
    sdoc (0.4.0)
      json (~> 1.8)
      rdoc (~> 4.0, < 5.0)
    simplecov (0.7.1)
      multi_json (~> 1.0)
      simplecov-html (~> 0.7.1)
    simplecov-html (0.7.1)
    spring (1.1.3)
    sprockets (2.11.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.1.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.9)
    subactions (1.0.1)
    systemu (2.6.4)
    therubyracer (0.12.1)
      libv8 (~> 3.16.14.0)
      ref
    thor (0.19.1)
    thread_safe (0.3.4)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.2.2)
      coffee-rails
    tzinfo (1.2.1)
      thread_safe (~> 0.1)
    uglifier (2.5.1)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unicorn (4.8.3)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    unicorn-rails (2.1.1)
      rack
      unicorn
    uuid (2.3.7)
      macaddr (~> 1.0)
    version (1.0.0)
    wasabi (3.3.0)
      httpi (~> 2.0)
      mime-types (< 2.0.0)
      nokogiri (>= 1.4.0)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  capybara
  coffee-rails (~> 4.0.0)
  database_cleaner
  jbuilder (~> 2.0)
  jquery-rails
  mysql2
  rails (= 4.1.2)
  rspec-rails (~> 3.0.0)
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  simplecov (~> 0.7.1)
  simplecov-html
  spring
  sqlite3
  subactions
  therubyracer
  turbolinks
  uglifier (>= 1.3.0)
  unicorn
  unicorn-rails
  version

EDIT3:这是我的 .irbrc 文件:

# This loads some niceties for irb, courtesy of rvm.
# It also loads your custom ~/.irbrc if it exists.
# If you want to customize the irbrc for ONLY this version of
# ruby then edit this file. It will only be deleted if you do
# an "rvm install" over this ruby version.

if ENV["rvm_path"].nil?
  require File.join(ENV["HOME"], "irbrc")
else
  require File.join(ENV["rvm_path"], "scripts", "irbrc")
end

【问题讨论】:

  • 如果运行:bundle exec rails c 会怎样?或./script/rails c?
  • 签出您的Gemfile.lock 文件,请发布
  • 删除 Gemfile.lock 然后进行捆绑安装
  • bundle exec rails c 没有区别。我已经删除了 Gemfile.lock 并安装了捆绑包(请阅读我的问题)。我会将我的 Gemfile.lock 添加到我的问题中。
  • 为了排除spring干扰的可能性,我时不时碰到。运行spring status 来检查它的状态。尝试使用 spring stop 然后 bundle 然后 rails c 停止它。

标签: ruby-on-rails ruby gem bundler activesupport


【解决方案1】:

春天仍在运行和干扰。在 shell 中运行以下命令就可以了:

spring stop

现在 Rails 控制台可以正常工作了。

【讨论】:

  • 为我解决了这个完全相同的问题。谢谢!
  • 谢谢!你刚刚把我从数小时的困惑和痛苦中解救了出来 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-14
  • 2020-04-25
  • 2014-10-26
相关资源
最近更新 更多