将`bundle exec`添加到你的命令可以解决这个问题

时间:2021-09-28 00:18:38

I am having an issue while deploying my site to AWS.

在将我的站点部署到AWS时遇到问题。

Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
  /var/app/ondeck/config/boot.rb:3:in `<top (required)>'
  /var/app/ondeck/config/application.rb:1:in `<top (required)>'
  /var/app/ondeck/Rakefile:4:in `<top (required)>'
  LoadError: cannot load such file -- bundler/setup
  /var/app/ondeck/config/boot.rb:3:in `<top (required)>'
  /var/app/ondeck/config/application.rb:1:in `<top (required)>'
  /var/app/ondeck/Rakefile:4:in `<top (required)>'
  (See full trace by running task with --trace)
   (ElasticBeanstalk::ExternalInvocationError)

while when I do gem list rake it gives me

而当我做宝石清单耙时,它给了我

*** LOCAL GEMS ***

airbrake (4.3.1)
rake (10.5.0, 10.4.2)

I want to have just one version when I do bundle exec gem uninstall rake -v 10.4.2 it gives me

我想只有一个版本,当我捆绑exec gem uninstall rake -v 10.4.2它给了我

ERROR:  While executing gem ... (Gem::InstallError)
    gem "rake" cannot be uninstalled because it is a default gem

How to resolve this issue? any help will be appreciated.

如何解决这个问题?任何帮助将不胜感激。

2 个解决方案

#1


9  

You need to prefix your command with bundle exec. For example, if your rake command is

您需要在命令前加上bundle exec。例如,如果您的rake命令是

rake deploy

You have instead to use

你改为使用

bundle exec rake deploy

Bundler will fetch the proper gem versions as listed in your Gemfile, and execute the command.

Bundler将获取Gemfile中列出的正确gem版本,并执行该命令。

#2


25  

First run bundle update rake .

首先运行bundle update rake。

I hope this works for you.

我希望这适合你。

#1


9  

You need to prefix your command with bundle exec. For example, if your rake command is

您需要在命令前加上bundle exec。例如,如果您的rake命令是

rake deploy

You have instead to use

你改为使用

bundle exec rake deploy

Bundler will fetch the proper gem versions as listed in your Gemfile, and execute the command.

Bundler将获取Gemfile中列出的正确gem版本,并执行该命令。

#2


25  

First run bundle update rake .

首先运行bundle update rake。

I hope this works for you.

我希望这适合你。