Heroku推送被拒绝:在源代码中找不到jquery-rails-2.0.0

Lea*_*cim 17 ruby-on-rails heroku

我正在尝试将Enki gem博客推向Heroku,我收到了一个错误

Could not find jquery-rails-2.0.0 in any of the sources
Run Code Online (Sandbox Code Playgroud)

但是,在我的Gemfile中

`gem 'jquery-rails'`
Run Code Online (Sandbox Code Playgroud)

我之前从未尝试使用此设置推送Enki博客.这是完整的错误消息

 Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
           Fetching gem metadata from https://rubygems.org/.......
           Could not find jquery-rails-2.0.0 in any of the sources
     !
     !     Failed to install gems via Bundler.
     !
     !     Heroku push rejected, failed to compile Ruby/rails app
Run Code Online (Sandbox Code Playgroud)

收到错误消息后,我将其添加到gemfile中

gem 'jquery-rails-2.0.0'
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息

Could not find gem 'jquery-rails-2.0.0 (>= 0) java' in the gems available on this machine.
Run Code Online (Sandbox Code Playgroud)

然后我试着去做

gem install jquery-rails
Run Code Online (Sandbox Code Playgroud)

它给了我

  Successfully installed jquery-rails-2.0.2
1 gem installed
Installing ri documentation for jquery-rails-2.0.2...
Installing RDoc documentation for jquery-rails-2.0.2...
Run Code Online (Sandbox Code Playgroud)

但推动不起作用,同样的错误

   -----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.rc
       Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
       Fetching gem metadata from https://rubygems.org/.......
       Could not find jquery-rails-2.0.0 in any of the sources
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app
Run Code Online (Sandbox Code Playgroud)

这是gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.6'
gem 'heroku'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  gem 'uglifier', '>= 1.0.3'
end

group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end

group :production do
  gem 'thin'
end
platforms :jruby do
  gem 'activerecord-jdbcsqlite3-adapter'
  gem 'trinidad'
  gem 'jruby-openssl'
end

gem 'jquery-rails'
#gem 'jquery-rails-2.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

# Bundle the extra gems:
gem 'RedCloth', '~> 4.2.9', :require => 'redcloth'
gem 'ruby-openid', :require => 'openid'
gem 'rack-openid', :require => 'rack/openid'
gem 'aaronh-chronic', :require => 'chronic' # Fixes for 1.9.2
gem 'coderay'
gem 'lesstile'
gem 'formtastic'
gem 'will_paginate', '~> 3.0.2'
gem 'exception_notification', '~> 2.5.2'
gem 'open_id_authentication'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :test do
  gem 'database_cleaner'
  gem 'cucumber-rails',    :require => false
  gem 'cucumber-websteps', :require => false
  gem 'factory_girl'
  gem 'rspec'
  gem 'nokogiri', '~> 1.5.0'
  gem 'webrat'
end

group :development, :test do
  gem 'rspec-rails'
end
Run Code Online (Sandbox Code Playgroud)

pwi*_*man 46

我得到了同样的错误,并使用以下方法修复:

bundle update jquery-rails

在调查中,似乎jquery-rails 2.0.0从rubygems中被拉出来:http://d.pr/i/cLms/1ReBI4U8 无论出于何种原因.所以你(和我)可能碰巧安装了jquery-rails,当时这个gem是最新的版本.

同样明智的是,删除你的内容Gemfile.lock可能很危险,在大多数情况下不推荐.这会导致下载Gemfile中没有版本号的每个gem的所有最新版本.如果宝石已经使用API​​破坏性更改进行更新(比您想象的更频繁发生),您的应用可能会中断.但它也可能没有.请小心,如果你有测试用例,请运行测试用例.这引起了我不止一次的头痛.

您可以在此处阅读有关bundler,Gemfile和Gemfile.lock如何工作的更多信息(以及如何正确升级某些gem的指导):http://viget.com/extend/bundler-best-practices

  • 你应该使用这个而不是上面的那个.上面的一个将更新rails并可能会破坏整个应用程序. (5认同)

小智 13

为我工作:

  • 删除Gemfile.lock
  • 从line => gem'trail'中移除了rails版本(jquery已经没有av编号)
  • 运行命令"bundle install"
  • 运行"捆绑更新jquery-rails"以确保一切都更新
  • 重要的是,提交新的.lock文件=>运行"git add".和"git commit ..."
  • 推动一切

  • 这可能是非常危险的 - 正如双头@pwightman在他/她的回答中所说的那样. (7认同)