heroku:Gemfile.lock是必需的问题

rom*_*man 14 ruby git production ruby-on-rails heroku

我有以下问题:

我正在尝试在heroku上部署我的项目,但是在我运行之后

git push heroku master
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

git push heroku master -f
Counting objects: 524, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (498/498), done.
Writing objects: 100% (524/524), 157.76 KiB, done.
Total 524 (delta 207), reused 62 (delta 2)
-----> Heroku receiving push 
-----> Ruby/Rails app detected
!
!     Gemfile.lock is required. Please run "bundle install" locally
!     and commit your Gemfile.lock.
!
!     Heroku push rejected, failed to compile Ruby/rails app
To git@heroku.com:*****.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:*****.git'
Run Code Online (Sandbox Code Playgroud)

我已经运行bundle install和bundle update几次,我试图删除Gemfile.lock从资源库中,并从我的文件系统.但我仍然得到同样的信息.谁能告诉我我做错了什么?

我想要推送的分支是从主人那里克隆出来的.

AMI*_*ING 22

一些事情

  1. 你在Geit中放置了Gemfile.lock吗?如果是,它是否锁定(意味着更新? - 你做了好几次只是仔细检查)
  2. 只需按照bundle install本地提示操作即可.
  3. 现在放置Gemfile.lock
    • git add . 或者您只能添加Gemfile.lock git add Gemfile.lock
    • git commit -m"在这里提交消息"
    • git push

现在git push heroku应该这样做.

  • 我已经好几次了,但仍然遇到了同样的问题 (3认同)

小智 6

在您的开发机器上运行 rm -rf .bundle && bundle install && git add Gemfile.lock && git commit -m "Added Gemfile.lock" 然后部署.


Ver*_*cus 5

很可能你的Gemfile.lock没有提交到你的存储库.使用git st并确保提交Gemfile.lock; 检查你的.gitignore文件,确保你不会无意中忽略它.

  • 我已经检查过了,这个文件在我的提交中.使用`git ls-files`来检查这个 (3认同)