Bundler无法找到gem的兼容版本

时间:2022-01-24 23:27:46

I've added a gem 'koala' to my Gemfile and seems to have thrown gem versions out of whack when I run the 'bundle install' command:

我在我的Gemfile中添加了一个gem“koala”,当我运行'bundle install'命令时,似乎已经抛出了宝石版本:

Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (0.6.1)

In Gemfile:
koala (~> 1.2.0beta1) depends on
  faraday (~> 0.7.4)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

How can I resolve this conflict?

我该如何解决这个冲突?

5 个解决方案

#1


50  

Delete the contents of Gemfile.lock, and run bundle install again. That's been working for me.

删除Gemfile.lock的内容,然后再次运行bundle install。这对我有用。

#2


27  

Did you run bundle update as the error message points out? bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler. The Gemfile.lock file locks in version numbers, bundle update will update any of those that aren't directly specified in your Gemfile (like gem 'rails', '3.0.9').

您是否在错误消息中指出了捆绑更新? bundle install处理已经由Bundler管理的Gemfile和bundle更新升级gems的更改。 Gemfile.lock文件锁定版本号,bundle update将更新任何未在Gemfile中直接指定的文件(如gem'rail','3.0.9')。

Deleting the Gemfile.lock will work, but running bundle update is better.

删除Gemfile.lock会起作用,但运行bundle update会更好。

#3


5  

I found that by removing the specified version of rails solved the problem for me .... instead of:

我发现通过删除指定版本的rails解决了我的问题....而不是:

gem rails, '4.0.4'

I did

我做到了

gem rails

followed by deleting the Gemfile.lock and re-running bundle install

然后删除Gemfile.lock并重新运行bundle install

#4


4  

You can't simply delete you Gemfile.lock if that is a solution then why Gemfile.lock is exist in the first place, you code depend on the versions locked in this file, try to only update the Gem which cause the conflict by using bundle update gem_name and you have to check the ReadMe if any changes needed to work with the new version otherwise you are breaking your code or others code.

您不能简单地删除Gemfile.lock如果这是一个解决方案,那么为什么Gemfile.lock首先存在,您的代码取决于此文件中锁定的版本,尝试仅更新导致冲突的Gem使用捆绑更新gem_name,如果需要对新版本进行任何更改,则必须检查自述文件,否则您将破坏代码或其他代码。

#5


1  

If deleting Gemfile.lock doesn't work there is another possibility:

如果删除Gemfile.lock不起作用,还有另一种可能性:

It may be possible a gem you are depending on has inadvertently included its own Gemfile.lock in its .gem file. The solution is to update the offending gems to not include a Gemfile.lock, rebuild and reinstall.

您可能依赖的gem可能无意中在其.gem文件中包含了自己的Gemfile.lock。解决方案是更新有问题的gem,不包括Gemfile.lock,重建并重新安装。

#1


50  

Delete the contents of Gemfile.lock, and run bundle install again. That's been working for me.

删除Gemfile.lock的内容,然后再次运行bundle install。这对我有用。

#2


27  

Did you run bundle update as the error message points out? bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler. The Gemfile.lock file locks in version numbers, bundle update will update any of those that aren't directly specified in your Gemfile (like gem 'rails', '3.0.9').

您是否在错误消息中指出了捆绑更新? bundle install处理已经由Bundler管理的Gemfile和bundle更新升级gems的更改。 Gemfile.lock文件锁定版本号,bundle update将更新任何未在Gemfile中直接指定的文件(如gem'rail','3.0.9')。

Deleting the Gemfile.lock will work, but running bundle update is better.

删除Gemfile.lock会起作用,但运行bundle update会更好。

#3


5  

I found that by removing the specified version of rails solved the problem for me .... instead of:

我发现通过删除指定版本的rails解决了我的问题....而不是:

gem rails, '4.0.4'

I did

我做到了

gem rails

followed by deleting the Gemfile.lock and re-running bundle install

然后删除Gemfile.lock并重新运行bundle install

#4


4  

You can't simply delete you Gemfile.lock if that is a solution then why Gemfile.lock is exist in the first place, you code depend on the versions locked in this file, try to only update the Gem which cause the conflict by using bundle update gem_name and you have to check the ReadMe if any changes needed to work with the new version otherwise you are breaking your code or others code.

您不能简单地删除Gemfile.lock如果这是一个解决方案,那么为什么Gemfile.lock首先存在,您的代码取决于此文件中锁定的版本,尝试仅更新导致冲突的Gem使用捆绑更新gem_name,如果需要对新版本进行任何更改,则必须检查自述文件,否则您将破坏代码或其他代码。

#5


1  

If deleting Gemfile.lock doesn't work there is another possibility:

如果删除Gemfile.lock不起作用,还有另一种可能性:

It may be possible a gem you are depending on has inadvertently included its own Gemfile.lock in its .gem file. The solution is to update the offending gems to not include a Gemfile.lock, rebuild and reinstall.

您可能依赖的gem可能无意中在其.gem文件中包含了自己的Gemfile.lock。解决方案是更新有问题的gem,不包括Gemfile.lock,重建并重新安装。