完成工作后,我将代码推送到github,然后决定通过heroku进行直播。我登录到heroku,添加ssh密钥,运行
heroku创建
但由于sqlite3的原因,它不允许我使用。然后,我将生产数据库指定为postgresql,然后重试。它给了我这个错误。
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to thawing-refuge-61904.
remote:
To https://git.heroku.com/thawing-refuge-61904.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/thawing-refuge-61904.git'
在这之后,我决定再次尝试"干净的heroku域"。所以我从我的heroku中删除了thawing-fuge-61904应用程序。
然后运行
heroku创建
并尝试再次推送。上面写着
remote: ! No such app as thawing-refuge-61904.
fatal: repository 'https://git.heroku.com/thawing-refuge-61904.git/' not found
然后在谷歌上做了一些研究后,我删除了thawing-repuge-61904.git(旧域(的远程git
git remote rm heroku
并为我的新域添加了远程git
git remote add heroku https://git.heroku.com/agile-escarpment-46150.git
但我仍然收到这个错误
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to agile-escarpment-46150.
remote:
To https://git.heroku.com/agile-escarpment-46150.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/agile-escarpment-46150.git'
我觉得我在某个地方搞砸了,我需要一些帮助。
解决:好吧,所以错误就在我一开始没有注意到的最上面:
You must use Bundler 2 or greater with this lockfile.
此问题已在此处解决:https://github.com/bundler/bundler/issues/6784#issuecomment-438562046
只运行
heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2
去那里真好!
您需要使用heroku keys:add
将SSH密钥添加到heroku
https://devcenter.heroku.com/articles/keys#adding-heroku 的密钥
尝试-删除gemfile.lock
文件
-
在gemfile中,删除
gem sqlite3
或类似的sqlite3-gem并添加以下内容:组:开发,:测试gem"sqlite3"终止gem"pg",组::生产
然后在终端中运行这些命令:
bundle install
git add .
git commit
git push heroku master
heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2
解决问题