我需要一些關于這個小應用程式的幫助,我想在完成后推送到 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
并且捆綁順利完成。我已經卡住了一段時間,并嘗試更換捆綁版本無濟于事。提前致謝!
uj5u.com熱心網友回復:
導致此錯誤的原因是您的存盤庫中有不正確的行尾(CRLF 與 LF),這通常是在您跨 Windows 和類 Unix 環境作業/部署時引起的。Mac/Unix/Linux 環境(Heroku 使用)使用單個換行符(通常表示為\n)來終止行,而 Windows 使用回車符/換行符對 ( \r\n)。
如果你的本地倉庫在 Windows 機器上,你需要在推送到 Heroku 之前轉換倉庫中的檔案。您可以將 Git 配置為處理自動轉換,以便在 Windows 上結帳時擁有 Windows 終止符,但僅使用換行符來維護存盤庫。
要設定自動轉換:
% git config --global core.autocrlf input
Git 還提供了一種重繪 repo 的方法,以確保所有行結尾都是正確的。這可能會導致合并頭痛,因為這會影響某些/所有檔案中的每一行,因此您最好希望在完全最新的 repo 上執行此操作(即,沒有未推送的更改)。
% git add --renormalize .
% git commit -m "Normalize all the line endings"
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/477398.html
上一篇:DynamoDB.create_table錯誤,帶有`ArgumentError:沒有這樣的成員:billing_mode`
