gpt4 book ai didi

node.js - 推送失败! [远程拒绝] master -> master(预接收 Hook 被拒绝)

转载 作者:太空宇宙 更新时间:2023-11-04 01:58:32 25 4
gpt4 key购买 nike

我在将 NodeJS 应用程序部署到 Heroku 时遇到问题。这是错误:

remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 5.3.0
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 5.3.0...
remote: Downloading and installing node 5.3.0...
remote: Detected package-lock.json: defaulting npm to version 5.x.x
remote: Bootstrapping npm 5.x.x (replacing 3.3.12)...
remote: npm 5.5.1 installed
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json + package-lock)
remote: npm ERR! Buffer.alloc is not a function
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /app/.npm/_logs/2017-10-21T22_24_56_159Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to young-ridge-96999.
remote:
To https://git.heroku.com/young-ridge-96999.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/young-ridge-96999.git

我已经尝试过有关其他 Stack Overflow 问题的建议:应用程序的 .gitignore 具有 node_modules/

package.json 有

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},

我尝试创建一个新分支并用新分支推送到 Heroku

git add .
git commit -a -m'comment'
git push

谢谢

最佳答案

这很可能是由于您使用旧版本的 Node.js 造成的。您可以使用 nvm 安装最新版本。在 package.json 中准确指定您在本地使用的 npm 版本 (npm --version) 也可能有所帮助,但我建议升级到最新版本的 Node。

关于node.js - 推送失败! [远程拒绝] master -> master(预接收 Hook 被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46868785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com