Heroku 推送被拒绝,因为 gems 安装失败
Heroku push rejected because gems fail to install
我需要一些关于这个小应用程序的帮助,我在完成后试图推送到 heroku
git add .
git commit -m "message here"
git push heroku master
我收到以下错误消息:
Enumerating objects: 174, done.
Counting objects: 100% (174/174), done.
Delta compression using up to 12 threads
Compressing objects: 100% (156/156), done.
Writing objects: 100% (174/174), 38.41 KiB | 2.40 MiB/s, done.
Total 174 (delta 62), reused 36 (delta 3)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.10
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.6
remote: -----> Installing dependencies using bundler 2.3.10
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: /usr/bin/env: ‘ruby\r’: No such file or directory
remote: Bundler Output: /usr/bin/env: ‘ruby\r’: No such file or directory
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to damp-spire-06287.
remote:
To https://git.heroku.com/damp-spire-06287.git
! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/damp-spire-06287.git
我不确定这是捆绑程序版本问题还是其他问题,但如果可能的话我需要任何帮助。我试过
bundle install and bundle update
捆绑包顺利完成。我被卡了一段时间,尝试更换捆绑版本无济于事。提前致谢!
此错误是因为您的回购中有不正确的行尾(CRLF 与 LF)引起的,这通常是在您 working/deploying 跨越 Windows 和 Unix-like 环境时引起的. Mac/Unix/Linux 环境——Heroku 使用的——使用单个换行符(通常表示为 \n
)字符来终止一行,而 Windows 使用回车符 return/linefeed 对(\r\n
).
如果您的本地存储库在 Windows 机器上,您需要在推送到 Heroku 之前转换存储库中的文件。您可以配置 Git 来处理 auto-conversion,这样当您在 Windows 上结账时,您有 Windows 终止符,但仅使用换行维护回购协议。
设置自动转换:
% git config --global core.autocrlf input
Git 还提供了一种刷新存储库的方法,以确保所有行尾都是正确的。这可能会导致合并问题,因为这会影响 some/all 文件中的每一行,因此您最好在完整的 up-to-date 存储库(即没有 un-pushed 更改)上执行此操作。
% git add --renormalize .
% git commit -m "Normalize all the line endings"
我需要一些关于这个小应用程序的帮助,我在完成后试图推送到 heroku
git add .
git commit -m "message here"
git push heroku master
我收到以下错误消息:
Enumerating objects: 174, done.
Counting objects: 100% (174/174), done.
Delta compression using up to 12 threads
Compressing objects: 100% (156/156), done.
Writing objects: 100% (174/174), 38.41 KiB | 2.40 MiB/s, done.
Total 174 (delta 62), reused 36 (delta 3)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.10
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.6
remote: -----> Installing dependencies using bundler 2.3.10
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: /usr/bin/env: ‘ruby\r’: No such file or directory
remote: Bundler Output: /usr/bin/env: ‘ruby\r’: No such file or directory
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to damp-spire-06287.
remote:
To https://git.heroku.com/damp-spire-06287.git
! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/damp-spire-06287.git
我不确定这是捆绑程序版本问题还是其他问题,但如果可能的话我需要任何帮助。我试过
bundle install and bundle update
捆绑包顺利完成。我被卡了一段时间,尝试更换捆绑版本无济于事。提前致谢!
此错误是因为您的回购中有不正确的行尾(CRLF 与 LF)引起的,这通常是在您 working/deploying 跨越 Windows 和 Unix-like 环境时引起的. Mac/Unix/Linux 环境——Heroku 使用的——使用单个换行符(通常表示为 \n
)字符来终止一行,而 Windows 使用回车符 return/linefeed 对(\r\n
).
如果您的本地存储库在 Windows 机器上,您需要在推送到 Heroku 之前转换存储库中的文件。您可以配置 Git 来处理 auto-conversion,这样当您在 Windows 上结账时,您有 Windows 终止符,但仅使用换行维护回购协议。
设置自动转换:
% git config --global core.autocrlf input
Git 还提供了一种刷新存储库的方法,以确保所有行尾都是正确的。这可能会导致合并问题,因为这会影响 some/all 文件中的每一行,因此您最好在完整的 up-to-date 存储库(即没有 un-pushed 更改)上执行此操作。
% git add --renormalize .
% git commit -m "Normalize all the line endings"