部署到heroku时如何解决rails中的更新捆绑器警告?

时间:2021-08-13 11:55:33

How do I solve the following warning? I updated my ruby version to 2.3.1 and rails version to 4.2.6. I get this warning when I push my app to heroku.

如何解决以下警告?我将我的ruby版本更新为2.3.1并将版本更新为4.2.6。当我将我的应用程序推送到heroku时,我收到此警告。

remote:        Cleaning up the bundler cache.
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        Removing mime-types-data (3.2016.0221)

I removed the Gemfile.lock and ran bundle install and also tried to update the bundler but the warning never goes away .

我删除了Gemfile.lock并运行了bundle install,并尝试更新捆绑包,但警告永远不会消失。

suramai@rails-tutorial:~/workspace/converse (master) $ gem install bundler
Successfully installed bundler-1.12.4
1 gem installed
suramai@rails-tutorial:~/workspace/converse (master) $

1 个解决方案

#1


45  

So it's complaining that the version of bundler installed on heroku is older than the version you used to create your Gemfile.lock on your dev machine.

所以它抱怨heroku上安装的bundler版本比你在dev机器上创建Gemfile.lock的版本要早。

You can probably just ignore the warning -- in most cases installing with a slightly older version of bundler than you used to create the Gemfile.lock is just fine.

你可以忽略这个警告 - 在大多数情况下,安装一个稍微旧版本的bundler比你用来创建Gemfile.lock就好了。

bundler recently added the recording of the version of bundler used in the Gemfile.lock, and then the subsequent warning, because in some cases a new feature added to a new version of bundler might have been used to create the Gemfile.lock, such that installing with an older version might not work right. So sometimes it can be a problem. Although usually it won't be.

bundler最近添加了Gemfile.lock中使用的bundler版本的记录,然后是后续警告,因为在某些情况下,添加到新版本的bundler的新功能可能已用于创建Gemfile.lock,这样使用旧版本安装可能无法正常工作。所以有时它可能是个问题。虽然通常不会。

It doesn't look like you can get heroku to install with a different version of bundler.

它看起来不像你可以使用不同版本的bundler安装heroku。

If you want to make the warning go away, you could instead choose to use the same version of bundler locally that heroku uses. It's a bit hard to figure out exactly what version of bundler heroku is using -- it would be nice if that warning line actually told you the two different versions of bundler involved! But it doesn't.

如果你想让警告消失,你可以选择使用heroku使用的本地捆绑器版本。要弄清楚heroku正在使用什么版本的捆绑包有点难以理解 - 如果该警告线实际上告诉您涉及捆绑器的两个不同版本,那就太好了!但事实并非如此。

This heroku support doc suggests that heroku is using bundler 1.11.2. (Right now; it could change in the future!). We can see from your log that you are using 1.12.4. If you want to use 1.11.2 instead, to avoid the warning, then, remove all versions of bundler installed on your system:

这个heroku支持文档表明heroku正在使用bundler 1.11.2。 (现在;它可能在未来改变!)。我们可以从您的日志中看到您使用的是1.12.4。如果要使用1.11.2而不是警告,则删除系统上安装的所有Bundler版本:

 gem uninstall bundler

Then install 1.11.2 specifically:

然后专门安装1.11.2:

 gem install bundler -v 1.11.2

In general, when you use the bundle command, it will use the latest version installed on your system, so to make sure you are always using 1.11.2, make sure that's the latest version installed on your system, and never install a later one.

通常,当您使用bundle命令时,它将使用系统上安装的最新版本,因此为了确保您始终使用1.11.2,请确保您的系统上安装了最新版本,并且永远不要安装以后的版本。

Then you need to regenerate your Gemfile.lock such that it says it was bundled with 1.11.2, to not get the warning anymore. This is kind of pain, the easiest thing to do might be to edit the Gemfile.lock by hand, and then going forward only ever use bundler 1.11.2.

然后你需要重新生成你的Gemfile.lock,它说它与1.11.2捆绑在一起,不再收到警告。这是一种痛苦,最简单的方法是手动编辑Gemfile.lock,然后继续使用bundler 1.11.2。

To use bundler 1.11.2 even if you do want to have later versions of bundler installed on your system, then every time you do a bundle install or bundle update (for an app that will be deployed to heroku anyway), you could do it as:

要使用bundler 1.11.2,即使您确实希望在系统上安装更高版本的bundler,那么每次进行捆绑安装或捆绑更新时(对于将部署到heroku的应用程序),您都可以执行此操作如:

 bundle _1.11.2_ install

etc. That will tell rubygems to run the bundle install command with bundler version 1.11.2, and then that version will be recorded in the Gemfile.lock, and you won't get the warning.

这将告诉rubygems使用bundler版本1.11.2运行bundle install命令,然后该版本将记录在Gemfile.lock中,您将不会收到警告。

This is all a bit of a mess. Many developers probably just ignore the warning. It should normally be fine.

这有点乱。许多开发人员可能只是忽略了警告。通常应该没问题。

#1


45  

So it's complaining that the version of bundler installed on heroku is older than the version you used to create your Gemfile.lock on your dev machine.

所以它抱怨heroku上安装的bundler版本比你在dev机器上创建Gemfile.lock的版本要早。

You can probably just ignore the warning -- in most cases installing with a slightly older version of bundler than you used to create the Gemfile.lock is just fine.

你可以忽略这个警告 - 在大多数情况下,安装一个稍微旧版本的bundler比你用来创建Gemfile.lock就好了。

bundler recently added the recording of the version of bundler used in the Gemfile.lock, and then the subsequent warning, because in some cases a new feature added to a new version of bundler might have been used to create the Gemfile.lock, such that installing with an older version might not work right. So sometimes it can be a problem. Although usually it won't be.

bundler最近添加了Gemfile.lock中使用的bundler版本的记录,然后是后续警告,因为在某些情况下,添加到新版本的bundler的新功能可能已用于创建Gemfile.lock,这样使用旧版本安装可能无法正常工作。所以有时它可能是个问题。虽然通常不会。

It doesn't look like you can get heroku to install with a different version of bundler.

它看起来不像你可以使用不同版本的bundler安装heroku。

If you want to make the warning go away, you could instead choose to use the same version of bundler locally that heroku uses. It's a bit hard to figure out exactly what version of bundler heroku is using -- it would be nice if that warning line actually told you the two different versions of bundler involved! But it doesn't.

如果你想让警告消失,你可以选择使用heroku使用的本地捆绑器版本。要弄清楚heroku正在使用什么版本的捆绑包有点难以理解 - 如果该警告线实际上告诉您涉及捆绑器的两个不同版本,那就太好了!但事实并非如此。

This heroku support doc suggests that heroku is using bundler 1.11.2. (Right now; it could change in the future!). We can see from your log that you are using 1.12.4. If you want to use 1.11.2 instead, to avoid the warning, then, remove all versions of bundler installed on your system:

这个heroku支持文档表明heroku正在使用bundler 1.11.2。 (现在;它可能在未来改变!)。我们可以从您的日志中看到您使用的是1.12.4。如果要使用1.11.2而不是警告,则删除系统上安装的所有Bundler版本:

 gem uninstall bundler

Then install 1.11.2 specifically:

然后专门安装1.11.2:

 gem install bundler -v 1.11.2

In general, when you use the bundle command, it will use the latest version installed on your system, so to make sure you are always using 1.11.2, make sure that's the latest version installed on your system, and never install a later one.

通常,当您使用bundle命令时,它将使用系统上安装的最新版本,因此为了确保您始终使用1.11.2,请确保您的系统上安装了最新版本,并且永远不要安装以后的版本。

Then you need to regenerate your Gemfile.lock such that it says it was bundled with 1.11.2, to not get the warning anymore. This is kind of pain, the easiest thing to do might be to edit the Gemfile.lock by hand, and then going forward only ever use bundler 1.11.2.

然后你需要重新生成你的Gemfile.lock,它说它与1.11.2捆绑在一起,不再收到警告。这是一种痛苦,最简单的方法是手动编辑Gemfile.lock,然后继续使用bundler 1.11.2。

To use bundler 1.11.2 even if you do want to have later versions of bundler installed on your system, then every time you do a bundle install or bundle update (for an app that will be deployed to heroku anyway), you could do it as:

要使用bundler 1.11.2,即使您确实希望在系统上安装更高版本的bundler,那么每次进行捆绑安装或捆绑更新时(对于将部署到heroku的应用程序),您都可以执行此操作如:

 bundle _1.11.2_ install

etc. That will tell rubygems to run the bundle install command with bundler version 1.11.2, and then that version will be recorded in the Gemfile.lock, and you won't get the warning.

这将告诉rubygems使用bundler版本1.11.2运行bundle install命令,然后该版本将记录在Gemfile.lock中,您将不会收到警告。

This is all a bit of a mess. Many developers probably just ignore the warning. It should normally be fine.

这有点乱。许多开发人员可能只是忽略了警告。通常应该没问题。