简体   繁体   English

我在将代码上传到 Heroku 时遇到很多问题

[英]I'm having a lot of issues uploading my code to Heroku

I'm having a lot of trouble deploying my code to Heroku.我在将代码部署到 Heroku 时遇到了很多麻烦。

I started by going to the Heroku logs.我首先访问了 Heroku 日志。 And, the photo is what was there.而且,照片就是那里的东西。 enter image description here在此处输入图像描述

So, I ran bundle install and got the error所以,我运行了 bundle install 并得到了错误

An error occurred while installing pg (1.2.3), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'`
succeeds before bundling.

Eventually, I got that corrected.最终,我得到了纠正。 Just decided to work for some reason.只是因为某种原因决定工作。 Then, however, I started getting another error when trying to deploy.但是,然后,我在尝试部署时开始遇到另一个错误。 The error was:错误是:

remote: !   Failed to install gems via Bundler.
4:32
remote: !   Push rejected to brownsapp.
remote: 
To https://git.heroku.com/brownsapp.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/brownsapp.git'

I then tried git push --force heroku .然后我尝试git push --force heroku No dice.没有骰子。 Then it came to thinking that it was trying to deploy from the wrong branch.然后它开始认为它试图从错误的分支进行部署。 But the main branch is the only branch I have.但是主分支是我唯一的分支。 I checked and made sure.我检查并确定。 Noticed that the terminal also said注意到终端还说

Warning - The same version of this code has already been built:

So, I ran git commit --allow-empty -m "Redeploying" trying to get the app deployed.所以,我运行了git commit --allow-empty -m "Redeploying"试图部署应用程序。

No dice.没有骰子。 Then I noticed another error saying:然后我注意到另一个错误说:

Your bundle only supports platforms ["x86_64-darwin-18"] but your local platform
remote:    is x86_64-linux.`

So, I ran the command bundle lock --add-platform x86_64-linux所以,我运行了命令bundle lock --add-platform x86_64-linux

And then the error continued to show.然后错误继续显示。 I tried deleting the Gemfile.lock file.我尝试删除 Gemfile.lock 文件。 That didn't help either.那也没有帮助。 I'm at a compete loss.我在竞争中失败了。 Any help would be appreciated.任何帮助,将不胜感激。

I fixed my problem by adding the linux platform to my bundler Gemfile.lock with this commande.我通过使用此命令将 linux 平台添加到我的捆绑器 Gemfile.lock 来解决我的问题。

bundle lock --add-platform x86_64-linux

Perhaps you can add it manually.也许您可以手动添加它。 Look for platform in your Gemfile.lock, see the picture here for help https://i.stack.imgur.com/PLpya.png在您的 Gemfile.lock 中查找平台,请参阅此处的图片以获取帮助https://i.stack.imgur.com/PLpya.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM