Ruby-on-rails 在任何来源中都找不到 rake-10.0.3
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14169828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not find rake-10.0.3 in any of the sources
提问by markhorrocks
I successfully installed a Rails (3.2.10) app on an Ubuntu 12.04 server on Rackspace following Railscasts 335 deploying to a vps. Nginx, Unicorn, rbenv and Capistrano.
在 Railscasts 335 部署到 vps 之后,我在 Rackspace 上的 Ubuntu 12.04 服务器上成功安装了 Rails (3.2.10) 应用程序。Nginx、独角兽、rbenv 和 Capistrano。
Then, when I try to install a second rails website I get the error "Could not find rake-10.0.3 in any of the sources" during cap:deploy. cap:setup and cap:check were successful. Additionally, there is no current directory under my application folder.
然后,当我尝试安装第二个 rails 网站时,我在 cap:deploy 期间收到错误“无法在任何来源中找到 rake-10.0.3”。cap:setup 和 cap:check 成功。此外,我的应用程序文件夹下没有当前目录。
If I cd into the releases directory and run bundle install it is using rake-10.0.3. The only difference between the two apps is that the new app I am trying to install uses the assets pipeline.
如果我 cd 进入发布目录并运行 bundle install 它正在使用 rake-10.0.3。这两个应用程序之间的唯一区别是我尝试安装的新应用程序使用资产管道。
Here is my deploy file which is identical for both apps, except for the set :application directive.
这是我的部署文件,除了 set :application 指令外,这两个应用程序都是相同的。
set :user, 'mark'
set :scm_passphrase, 'xxxx'
set :domain, '99.99.99.99'
set :application, "my_app"
set :repository, "#{user}@#{domain}:git/#{application}.git"
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/#{application}"
role :app, domain
role :web, domain
role :db, domain, :primary => true
default_run_options[:pty] = true
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
after "deploy", "deploy:cleanup" # keep only the last 5 releases
namespace :deploy do
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
before "deploy", "deploy:check_revision"
end
回答by Festus Tamakloe
Remove all the versions of Rake ==> gem uninstall rake
Remove Gemfile.lock ==> rm Gemfile.lock
Run bundle install ==> bundle install
删除所有版本的 Rake ==>gem uninstall rake
删除 Gemfile.lock ==>rm Gemfile.lock
运行 bundle install ==>bundle install
gem install rake --version=10.0.2
if you still get the error then put this into your gemfile.
如果您仍然收到错误,请将其放入您的 gemfile 中。
gem 'rake', '0.8.7'
回答by ersentekin
bundle update rake
worked for me. I've had similar problem.
对我来说有效。我有过类似的问题。
回答by Tim S
If your still looking for a fix... For me it was a matter of using sudo bundle installinstead of just bundle install.
如果您仍在寻找修复程序...对我来说,这是使用sudo bundle install而不是仅bundle install.
回答by copremesis
I had this same cryptic error message .... turns out I had created a 'cloned' release inside the release folder which causes sprockets to want to do things there .... I think cap uses the create date as it traverses the release tree so somehow this messed things up .... be sure there are no additional 'hand made' folders in your /releases/ folder and you should get past this bug
我有同样的神秘错误消息......结果我在发布文件夹中创建了一个“克隆”发布,这导致链轮想要在那里做事情......我认为 cap 使用创建日期,因为它遍历发布树所以不知何故这把事情搞砸了......确保你的 /releases/ 文件夹中没有额外的“手工制作”文件夹,你应该克服这个错误
回答by Michael Yagudaev
I had the same problem. The cause for my problem was that Rake was also found in /usr/bin/local/in addition to being in the shims directory in rbenv. To check if this is the problem first uninstall rake gem uninstall rakethen run which rake. If you get back a path that is different than /Users/username/.rbenv/shims/rakethen just remove that binary using sudo rm /path/to/file.
我有同样的问题。我的问题的原因是,/usr/bin/local/除了在 rbenv 的 shims 目录中之外,还发现了 Rake 。要检查这是否是问题,请先卸载 rakegem uninstall rake然后运行which rake。如果您返回的路径与/Users/username/.rbenv/shims/rake使用sudo rm /path/to/file.
Note that in my case at least, which gemwas using a shimed executable that was managed by rbenv, while rake wasn't. So everything worked find until I tried to invoke rake commandfrom the terminal.
请注意,至少在我的情况下,which gem使用的是由 rbenv 管理的 shimed 可执行文件,而 rake 则不是。所以一切都找到了,直到我试图rake command从终端调用。
Also see: After installing rbenv and changing Ruby version, Rake no longer runs
回答by Brilliant-DucN
For rails version from 4.3, let try with bundle exec rails app:update. It worked for me.
对于 4.3 的 rails 版本,让我们尝试使用bundle exec rails app:update. 它对我有用。
Hope it's useful for you.
希望对你有用。

