Gemfile.lock not checked in - Heroku

2019-02-05 23:49发布

While trying to "git push heroku master", I keep getting the error :

Counting objects: 266, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (239/239), done.
Writing objects: 100% (266/266), 222.68 KiB, done.
Total 266 (delta 55), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
       Unresolved dependencies detected; Installing...
       Using --without development:test
       You have modified your Gemfile in development but did not check
       the resulting snapshot (Gemfile.lock) into version control

       You have deleted from the Gemfile:
       * version: 1.0.6
       FAILED: http://docs.heroku.com/bundler
 !     Heroku push rejected, failed to install gems via Bundler

error: hooks/pre-receive exited with error code 1
To git@heroku.com:freezing-frost-65.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:freezing-frost-65.git'

I tried adding Gemfile and Gemfile.lock to git but to no avail. I tried removing .bundle directory and Gemfile.lock but the same error.

6条回答
你好瞎i
2楼-- · 2019-02-06 00:17

There is a problem with bundler version 1.0.6 You need to run "gem update bundler" on your development machine to update bundler to 1.0.7. Then you need to run bundle update in your app to generate a new Gemfile.lock file. You will see that the Gemfile.lock is updated. Commit this new Gemfile.lock and push to heroku again.

查看更多
疯言疯语
3楼-- · 2019-02-06 00:18

I fixed mine by opening Gemfile.lock and deleting the following two lines:

PLATFORMS
  x86-mingw32

So now i just need to make a script that bundles then removes that from the lock file.

查看更多
唯我独甜
4楼-- · 2019-02-06 00:19

In your applicaton directory, in the bin subdirectory modify the files

bin/bundle 
bin/rails 
bin/rake 

Instead of

'#!/usr/bin/env ruby.exe

must be

'#!/usr/bin/env ruby

(thanks to previous post)

Make sure there are no references to windows in the gemfile.lock - they can just be deleted.

Then

git push heroku master

If there are still problems use heroku logs (copying text to a text editor makes it easier to cut and paste for solutions).

查看更多
一夜七次
5楼-- · 2019-02-06 00:24

Both the Gemfile and Gemfile.lock files needs to be included in the git repository. Make sure you are not ignoring them in the .gitignore file.

Also, make sure you are using Bundler >= 1.0.0 on your local machine to generate the Gemfile.lock. I you use an outdated version, such as Bundler 0.9x, it will fail.

Last but not least, update your Gemfile.lock if you have one.

$ cd /path/to/project
$ bundle update
查看更多
劫难
6楼-- · 2019-02-06 00:36

I deleted the "mingw" line under PLATFORMS on my Gemfile.lock file, added and committed to git, pushed it to git, then pushed everything to heroku and apparently it works now.

查看更多
登录 后发表回答