新手问题 bundle install (An error occurred while installing rake (10.0.3),)

chita · 2013年03月15日 · 最后由 peter 回复于 2016年07月25日 · 13370 次阅读

D:\ruby or rails\blog>bundle install Fetching gem metadata from https://rubygems.org/........... Fetching gem metadata from https://rubygems.org/..

NoMethodError: private method open' called for Gem::Package:Class An error occurred while installing rake (10.0.3), and Bundler cannot continue. Make sure thatgem install rake -v '10.0.3'` succeeds before bundling.

D:\ruby or rails\blog>gem install rake ERROR: Could not find a valid gem 'rake' (>= 0) in any repository

D:\ruby or rails\blog>gem update Updating installed gems Nothing to update

D:\ruby or rails\blog>gem install rake ERROR: Could not find a valid gem 'rake' (>= 0) in any repository

D:\ruby or rails\blog>rake -V rake, version 10.0.3

D:\ruby or rails\blog>gem env RubyGems Environment:

  • RUBYGEMS VERSION: 2.0.3
  • RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [i386-mingw32]
  • INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
  • EXECUTABLE DIRECTORY: C:/Ruby193/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-mingw32
  • GEM PATHS:
    • C:/Ruby193/lib/ruby/gems/1.9.1
    • C:/Users/b/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
    • :sources => []
  • REMOTE SOURCES:

明明 有 rake 但却 rake 报错... 这是啥情况 求破...

bundle exec bundle install 试试看看是不是这个原因哦!

#1 楼 @smallbug

[31mCould not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available on this machine.[0m [33mRun bundle install to install missing gems.[0m

不会要一个个的 install 吧

你把你的 lock 给删除掉,然后重新给 bundle exec bundle install

#3 楼 @smallbug

Gemfile.lock?没这个文件

你把你的 gemfile 文件给贴出来看看哦!

没改过

source 'https://rubygems.org'

gem 'rails', '3.2.12'

Bundle edge Rails instead:

gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

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'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3' end

gem 'jquery-rails'

To use ActiveModel has_secure_password

gem 'bcrypt-ruby', '~> 3.0.0'

To use Jbuilder templates for JSON

gem 'jbuilder'

Use unicorn as the app server

gem 'unicorn'

Deploy with Capistrano

gem 'capistrano'

To use debugger

gem 'debugger'

#5 楼 @smallbug

先安装 gem install rake -v '10.0.3' 试试。

那你装一下这个试试 jquery-rails (>= 0) x86-mingw32

#7 楼 @Jijin

装过了 见一楼

D:\ruby or rails\blog>gem install rake -v '10.0.3' Successfully installed rake-10.0.3 Installing ri documentation for rake-10.0.3 1 gem installed

bundle install 还是一样的错误

#8 楼 @smallbug

所以只能一个一个的 install 了?

不是的呀,你先看看装这个看看别的可以不。要是和这个一样肯定就是装的东西有问题咯。

#11 楼 @smallbug

一个一个的装都可以

D:\ruby or rails\blog>gem install sqlite3 Fetching: sqlite3-1.3.7-x86-mingw32.gem (100%) Successfully installed sqlite3-1.3.7-x86-mingw32 unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF 12 for CHANGELOG.rdoc, skipping Installing ri documentation for sqlite3-1.3.7-x86-mingw32 1 gem installed

不懂为啥 bundle install 的时候 rake 会错误

你再给 bundle exec bundle install 看看

然后就提示装下一个

D:\ruby or rails\blog>bundle exec bundle install [31mCould not find gem 'sass-rails (~> 3.2.3) x86-mingw32' e on this machine.[0m [33mRun bundle install to install missing gems.[0m

#13 楼 @smallbug

gem update bundler

终结此贴 = =

感谢 @smallbug @Jijin

如果 rake 版本太高,可以这样。。。 rvm use 1.8.7@global 当然,版本根据你自己的情况,关键是 global

然后再 gem list 好吧,rake (10.0.3) 就躺在这里 你可以 gem uninstall rake 换一个低版本的。。。

在到你自己的 rvm gemsets 里。。。 再 gem list,嘿嘿,rake 的版本就是你后面的装版本

windows 下有 rvm 么

没有 rvm,不过有一个差不多的,忘了叫啥了

@zhangyanan 晕,这几百年前的贴了

也遇到了类似的问题,使用过大家的方法,但仍然提示 rake aborted。求大神帮助 localhost:octopress Siri$ rake install rake aborted! Gem::LoadError: You have already activated rake 11.2.2, but your Gemfile requires rake 10.5.0. Prepending bundle exec to your command may solve this. /Users/Siri/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:35:in block in setup' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:inmap' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:in setup' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler.rb:95:insetup' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/setup.rb:9:in <top (required)>' /Users/Siri/octopress/Rakefile:2:in' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/rake-11.2.2/exe/rake:27:in <top (required)>' LoadError: cannot load such file -- bundler/setup /Users/Siri/octopress/Rakefile:2:in' /Users/Siri/.rvm/gems/ruby-2.3.0/gems/rake-11.2.2/exe/rake:27:in `' (See full trace by running task with --trace)

#21 楼 @pmyangliu 如果你不 @ 某个人的话,没有人会注意到你在旧帖发言的。

可以按提示,rake 命令加 --trace 找到安装目录,比如 ~/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems, 确认是不是最高版本就是 10.5.0, 如果是,直接 gem update rake 就可以了,

需要 登录 后方可回复, 如果你还没有账号请 注册新账号