Node.js 错误:无法在heroku中推送某些引用
我在网上学习如何在Heroku部署的课程。我制作了一个Git存储库,上传并提交了那里的所有文件。然后我键入以下命令:Node.js 错误:无法在heroku中推送某些引用,node.js,heroku,heroku-cli,Node.js,Heroku,Heroku Cli,我在网上学习如何在Heroku部署的课程。我制作了一个Git存储库,上传并提交了那里的所有文件。然后我键入以下命令: heroku创建 heroku git:remote-由heroku提供的名称 git-push-heroku-main 在命令3之后,我在cmd中遇到了这个错误: Enumerating objects: 4357, done. Counting objects: 100% (4357/4357), done. Delta compression using up to 4 t
heroku创建
heroku git:remote-由heroku提供的名称
git-push-heroku-main
Enumerating objects: 4357, done.
Counting objects: 100% (4357/4357), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4125/4125), done.
Writing objects: 100% (4357/4357), 3.64 MiB | 297.00 KiB/s, done.
Total 4357 (delta 935), reused 3 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.20.0...
remote: Using default npm version: 6.14.8
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote:
remote: > bcrypt@5.0.0 install /tmp/build_88514da7/node_modules/bcrypt
remote: > node-pre-gyp install --fallback-to-build
remote:
remote: sh: 1: node-pre-gyp: Permission denied
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! bcrypt@5.0.0 install: `node-pre-gyp install --fallback-to-build`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the bcrypt@5.0.0 install script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.MO7JR/_logs/2020-12-15T17_16_14_007Z-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: Some possible problems:
remote:
remote: - node_modules checked into source control
remote: https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 safe-dawn-68695.
remote:
To https://git.heroku.com/safe-dawn-68695.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/safe-dawn-68695.git'
我是新来Heroku的,所以我无法理解错误是怎么说的。还尝试了使用git-push-heroku-HEAD:master,但遇到了相同的错误
如何解决此问题?参考本文:
删除根文件夹rm-rf node_modules中的node_modules文件夹,因为heroku将安装所有依赖项,我希望这能起作用
因此,请删除您的节点模块文件夹并再次执行1 2 3问题在于您的ByScript是否搜索了错误消息?是的,我搜索了此错误并找到了一些关于进行新回购的答案,然后使用相同的方法,尝试“git push heroku HEAD:master”,它为其他人工作并创建了一个分支,然后尝试在其上部署,但出现了相同的错误。没有提到bcrypt,因此我无法挖掘太多。因为它在这里失败>bcrypt@5.0.0安装/tmp/build_88514da7/node_模块/bcrypt remote:>节点预gyp安装--回退以构建远程:远程:sh:1:node pre gyp:权限被拒绝那么我解决此问题的下一步是什么?我卸载并重新安装了bcrypt,但它不起作用您需要此模块吗?它起作用了!!非常感谢您为解决此问题花费的时间和精力。我非常感谢。不客气:)