【发布时间】:2021-06-20 11:47:28
【问题描述】:
当我尝试使用 git push heroku master 部署到 Heroku 时,出现以下错误:! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/afternoon-inlet-19669.git'
我找到了另一个StackOverflow question,它帮助我摆脱了我的第一个错误。显然 GitHub 不会在提交时更新文件名的大小写更改。所以,我意识到我有一个名为 spinner.js 的文件,在我的本地机器上实际上名为 Spinner.js。
但是现在,我又遇到了错误。
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.0...
Using default npm version: 6.14.4
-----> Installing dependencies
Installing node modules (package.json + package-lock)
> nodemon@2.0.4 postinstall /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
added 370 packages from 220 contributors and audited 371 packages in 12.257s
12 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
-----> Build
Running heroku-postbuild
> devconnector@1.0.0 heroku-postbuild /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
> core-js@2.6.11 postinstall /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48/client/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.6.5 postinstall /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48/client/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure@3.6.5 postinstall /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48/client/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
added 1686 packages from 803 contributors and audited 1690 packages in 41.105s
59 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
> client@0.1.0 build /tmp/build_94cb6f8d6d9567ec2a8f7d9ac35a0f48/client
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/components/dashboard/Dashboard.js
Cannot find file '../layout/Spinner' in './src/components/dashboard'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.BfgW5/_logs/2020-06-17T17_40_23_134Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! devconnector@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the devconnector@1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.BfgW5/_logs/2020-06-17T17_40_23_146Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
这是我在 GitHub 上的项目的链接,知道 Heroku 拒绝推送应用程序的原因吗? My Project Link
编辑
我相信解决方案是让 Github 意识到我的文件名已更改,它必须仍然认为该文件名为 spinner.js。
【问题讨论】:
-
检查项目目录中的
.gitignore文件,看看Spinner是否被忽略 -
没有,我查过了,.gitignore 文件里没有
标签: git heroku npm heroku-cli