部署到heroku时如何解决Rails中的更新捆绑程序警告? [英] How to solve the update bundler warning in rails when deploying to heroku?

查看:95
本文介绍了部署到heroku时如何解决Rails中的更新捆绑程序警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决以下警告?我将ruby版本更新为2.3.1,并将rails版本更新为4.2.6。

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.

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)

我删除了Gemfile .lock并运行捆绑软件安装,并尝试更新捆绑软件,但警告永不消失。

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

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


推荐答案

所以它抱怨在heroku上安装的捆绑器版本是比您在开发机上创建 Gemfile.lock 的版本要旧。

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.

您可能只是忽略了该警告-在大多数情况下,使用比创建 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 中使用的捆绑器版本的记录,然后是随后的警告,因为在某些情况下,可能会使用添加到新版本捆绑程序中的新功能来创建 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.

看起来好像你不能让heroku与其他版本的捆绑器一起安装

如果要使警告消失,您可以选择在本地使用heroku使用的同一版本的捆绑器。确切弄清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使用捆绑程序 1.11.2 。 (现在;将来可能会改变!)。从您的日志中我们可以看到您正在使用 1.12.4 。如果要改用 1.11.2 ,为避免出现警告,请删除系统上安装的所有捆绑程序版本:

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:

 gem uninstall bundler

然后安装 1.11.2 专门:

 gem install bundler -v 1.11.2

通常,当您使用 bundle 命令时,它将使用系统上已安装的最新版本,因此请确保始终使用 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.

然后,您需要重新生成 Gemfile.lock ,使其说它与 1.11.2 ,不再收到警告。这是种痛苦,最简单的操作可能是手动编辑 Gemfile.lock ,然后继续仅使用捆绑器 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.

要使用捆绑软件 1.11.2 ,即使您确实希望在系统上安装更高版本的捆绑软件,那么每次您进行捆绑安装捆绑更新(对于仍将部署到heroku的应用程序)时,您可以这样做:

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:

 bundle _1.11.2_ install

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

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.

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

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

这篇关于部署到heroku时如何解决Rails中的更新捆绑程序警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆