安装后无法立即找到bcrypt

时间:2014-11-18 09:22:47

标签: ruby-on-rails ruby ruby-on-rails-4 devise bcrypt

在Rails 4.1项目中,我刚添加了设计并运行bundle install。在那之后,由于缺少bcrypt,没有命令可以工作:

$ rails c
Could not find bcrypt-3.1.9 in any of the sources
Run `bundle install` to install missing gems.
$ rails generate devise:install
Could not find bcrypt-3.1.9 in any of the sources
Run `bundle install` to install missing gems.
$ bundle exec rails generate devise:install
Could not find bcrypt-3.1.9 in any of the sources
Run `bundle install` to install missing gems.

即使已经安装了它:

$ bundle show
Gems included by the bundle:
  * actionmailer (4.1.8)
  * actionpack (4.1.8)
  * actionview (4.1.8)
  * activemodel (4.1.8)
  * activerecord (4.1.8)
  * activesupport (4.1.8)
  * arel (5.0.1.20140414130214)
  * bcrypt (3.1.9)
  * builder (3.2.2)
  * bundler (1.7.6)
  * coffee-rails (4.0.1)
  * coffee-script (2.3.0)
  * coffee-script-source (1.8.0)
  * devise (3.4.1)
  * domain_name (0.5.22)
  * erubis (2.7.0)
  * execjs (2.2.2)
  * haml (4.0.5)
  * haml-rails (0.5.3)
  * hike (1.2.3)
  * http-cookie (1.0.2)
  * i18n (0.6.11)
  * jbuilder (2.2.5)
  * jquery-rails (3.1.2)
  * json (1.8.1)
  * mail (2.6.3)
  * mechanize (2.7.3)
  * mime-types (2.4.3)
  * mini_portile (0.6.1)
  * minitest (5.4.3)
  * multi_json (1.10.1)
  * net-http-digest_auth (1.4)
  * net-http-persistent (2.9.4)
  * nokogiri (1.6.4.1)
  * ntlm-http (0.1.1)
  * orm_adapter (0.5.0)
  * pg (0.17.1)
  * rack (1.5.2)
  * rack-test (0.6.2)
  * rails (4.1.8)
  * railties (4.1.8)
  * rake (10.3.2)
  * rdoc (4.1.2)
  * responders (1.1.2)
  * sass (3.2.19)
  * sass-rails (4.0.4)
  * sdoc (0.4.1)
  * spring (1.1.3)
  * sprockets (2.11.3)
  * sprockets-rails (2.2.0)
  * thor (0.19.1)
  * thor-rails (0.0.1)
  * thread_safe (0.3.4)
  * tilt (1.4.1)
  * turbolinks (2.5.2)
  * tzinfo (1.2.2)
  * uglifier (2.5.3)
  * unf (0.1.4)
  * unf_ext (0.0.6)
  * warden (1.2.3)
  * webrobots (0.1.1)
$ bundle show bcrypt
/Users/pupeno/.rvm/gems/ruby-2.1.4@efc/gems/bcrypt-3.1.9

My Gemfile如下所示:

来源“https://rubygems.org

gem "coffee-rails", "~> 4.0.0"
gem "jbuilder", "~> 2.0"
gem "jquery-rails"
gem "rails", ">= 4.1.6"
gem "sass-rails", "~> 4.0.3"
gem "sdoc", "~> 0.4.0", group: :doc
gem "spring", group: :development
gem "pg"
gem "thor-rails"
gem "turbolinks"
gem "uglifier", ">= 1.3.0"
gem "mechanize"
gem "haml"
gem "haml-rails"
gem "devise"

我的Gemfile.lock看起来像这样:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.1.8)
      actionpack (= 4.1.8)
      actionview (= 4.1.8)
      mail (~> 2.5, >= 2.5.4)
    actionpack (4.1.8)
      actionview (= 4.1.8)
      activesupport (= 4.1.8)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    actionview (4.1.8)
      activesupport (= 4.1.8)
      builder (~> 3.1)
      erubis (~> 2.7.0)
    activemodel (4.1.8)
      activesupport (= 4.1.8)
      builder (~> 3.1)
    activerecord (4.1.8)
      activemodel (= 4.1.8)
      activesupport (= 4.1.8)
      arel (~> 5.0.0)
    activesupport (4.1.8)
      i18n (~> 0.6, >= 0.6.9)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.1)
      tzinfo (~> 1.1)
    arel (5.0.1.20140414130214)
    bcrypt (3.1.9)
    builder (3.2.2)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.3.0)
      coffee-script-source
      execjs
    coffee-script-source (1.8.0)
    devise (3.4.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    domain_name (0.5.22)
      unf (>= 0.0.5, < 1.0.0)
    erubis (2.7.0)
    execjs (2.2.2)
    haml (4.0.5)
      tilt
    haml-rails (0.5.3)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 3.1, < 5.0)
      railties (>= 4.0.1)
    hike (1.2.3)
    http-cookie (1.0.2)
      domain_name (~> 0.5)
    i18n (0.6.11)
    jbuilder (2.2.5)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (3.1.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mechanize (2.7.3)
      domain_name (~> 0.5, >= 0.5.1)
      http-cookie (~> 1.0)
      mime-types (~> 2.0)
      net-http-digest_auth (~> 1.1, >= 1.1.1)
      net-http-persistent (~> 2.5, >= 2.5.2)
      nokogiri (~> 1.4)
      ntlm-http (~> 0.1, >= 0.1.1)
      webrobots (>= 0.0.9, < 0.2)
    mime-types (2.4.3)
    mini_portile (0.6.1)
    minitest (5.4.3)
    multi_json (1.10.1)
    net-http-digest_auth (1.4)
    net-http-persistent (2.9.4)
    nokogiri (1.6.4.1)
      mini_portile (~> 0.6.0)
    ntlm-http (0.1.1)
    orm_adapter (0.5.0)
    pg (0.17.1)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.1.8)
      actionmailer (= 4.1.8)
      actionpack (= 4.1.8)
      actionview (= 4.1.8)
      activemodel (= 4.1.8)
      activerecord (= 4.1.8)
      activesupport (= 4.1.8)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.1.8)
      sprockets-rails (~> 2.0)
    railties (4.1.8)
      actionpack (= 4.1.8)
      activesupport (= 4.1.8)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.3.2)
    rdoc (4.1.2)
      json (~> 1.4)
    responders (1.1.2)
      railties (>= 3.2, < 4.2)
    sass (3.2.19)
    sass-rails (4.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.2)
      sprockets (~> 2.8, < 2.12)
      sprockets-rails (~> 2.0)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    spring (1.1.3)
    sprockets (2.11.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.2.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    thor (0.19.1)
    thor-rails (0.0.1)
      rails
      thor
    thread_safe (0.3.4)
    tilt (1.4.1)
    turbolinks (2.5.2)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.5.3)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.6)
    warden (1.2.3)
      rack (>= 1.0)
    webrobots (0.1.1)

PLATFORMS
  ruby

DEPENDENCIES
  coffee-rails (~> 4.0.0)
  devise
  haml
  haml-rails
  jbuilder (~> 2.0)
  jquery-rails
  mechanize
  pg
  rails (>= 4.1.6)
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  spring
  thor-rails
  turbolinks
  uglifier (>= 1.3.0)

3 个答案:

答案 0 :(得分:2)

这是春天的问题(我知道,wtf?)。基本上,我这样做了:

$ ps aux | grep spring

wendybeth      32281   0.0  0.2  2490496  16280   ??  S    Fri01PM   0:00.79 spring server | marketing | started 75 hours ago    

$ kill 32281

我是Rails&amp;的新手发展作为一个整体,我很紧张地说,这个解决方案没有任何副作用。我明白了:

https://jasonplayne.com/web-dev/rails-generate-could-not-find-in-any-of-the-sources

它对我有用。我不知道为什么 - 所以除非你自己理解,否则请谨慎使用。 :/

答案 1 :(得分:1)

尝试bundle exec rails c,在Gemfile中的gem中运行rails服务器。

答案 2 :(得分:0)

请尝试以下操作:

gem update bundler
bundle install 
rails console