所以我正在尝试部署我的第一个应用程序,并遇到了一些麻烦,看起来我一直在收到关于“运行版本的Bundler比创建锁文件的版本更旧”的警告。有关如何将更新的Gemfile.lock替换为版本控制的任何想法。以下是完整错误:
kparekh01:~/workspace/hello_app (master) $ git push heroku master
Counting objects: 68, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (57/57), done.
Writing objects: 100% (68/68), 17.20 KiB | 0 bytes/s, done.
Total 68 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
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: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: You have added to the Gemfile:
remote: * sass-rails (= 5.0.2)
remote: * uglifier (= 2.5.3)
remote: * coffee-rails (= 4.1.0)
remote: * jquery-rails (= 4.0.3)
remote: * turbolinks (= 2.3.0)
remote: * jbuilder (= 2.2.3)
remote: * sdoc (= 0.4.0)
remote: * sqlite3 (= 1.3.9)
remote: * byebug (= 3.4.0)
remote: * web-console (= 2.0.0.beta3)
remote: * spring (= 1.1.3)
remote: * pg (= 0.17.1)
remote: * rails_12factor (= 0.0.2)
remote: You have deleted from the Gemfile:
remote: * byebug
remote: * coffee-rails (~> 4.1.0)
remote: * jbuilder (~> 2.0)
remote: * jquery-rails
remote: * sass-rails (~> 5.0)
remote: * sdoc (~> 0.4.0)
remote: * spring
remote: * sqlite3
remote: * turbolinks
remote: * uglifier (>= 1.3.0)
remote: * web-console (~> 2.0)
remote: Bundler Output: 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: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have added to the Gemfile:
remote: * sass-rails (= 5.0.2)
remote: * uglifier (= 2.5.3)
remote: * coffee-rails (= 4.1.0)
remote: * jquery-rails (= 4.0.3)
remote: * turbolinks (= 2.3.0)
remote: * jbuilder (= 2.2.3)
remote: * sdoc (= 0.4.0)
remote: * sqlite3 (= 1.3.9)
remote: * byebug (= 3.4.0)
remote: * web-console (= 2.0.0.beta3)
remote: * spring (= 1.1.3)
remote: * pg (= 0.17.1)
remote: * rails_12factor (= 0.0.2)
remote:
remote: You have deleted from the Gemfile:
remote: * byebug
remote: * coffee-rails (~> 4.1.0)
remote: * jbuilder (~> 2.0)
remote: * jquery-rails
remote: * sass-rails (~> 5.0)
remote: * sdoc (~> 0.4.0)
remote: * spring
remote: * sqlite3
remote: * turbolinks
remote: * uglifier (>= 1.3.0)
remote: * web-console (~> 2.0)
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to murmuring-forest-66232.
remote:
To https://git.heroku.com/murmuring-forest-66232.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/murmuring-forest- 66232.git'
答案 0 :(得分:0)
首先使用
确保您的捆绑包是最新的`gem install bundler'
接下来再次运行捆绑包安装并确保完成。导致此问题的主要原因是gem文件和锁定文件不匹配。捆绑器是更新锁定文件的内容。
答案 1 :(得分:0)
警告消息表示您需要运行gem install bundler
才能获得最新版本的bundler。执行此操作bundle install
后,这将更新您应该推送到存储库的Gemfile.lock。我将建议阅读此SO post以了解有关Gemfile和Gemfile.lock
答案 2 :(得分:0)
您可以解决错误,并且可以在更新捆绑包后将您的应用程序上传到heroku。要在命令下面安装和更新bundle使用。
$ bundle install
$ bundle update
这是您每次对gem文件进行任何更改时必须遵循的常规过程,以便通过您在gem文件中进行的新编辑来了解应用程序。
答案 3 :(得分:0)
没关系,终于想通了我的错误,这很简单。我正确地安装和更新了所有内容,但是因为我在云端9上执行此操作,所以我不得不git add,git commit和git推送我的更改,只要我活着,我永远不会忘记这一切。谢谢你所有的帮助。