Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku无法使用bcrypt部署node.js_Node.js_Heroku_Bcrypt_Bookshelf.js - Fatal编程技术网

Heroku无法使用bcrypt部署node.js

Heroku无法使用bcrypt部署node.js,node.js,heroku,bcrypt,bookshelf.js,Node.js,Heroku,Bcrypt,Bookshelf.js,在向我的服务器添加bookshelf安全密码后,heroku在部署我的服务器时失败,它一直说它无法安装bcrypt NPM_CONFIG_DISTURL=https://nodejs.org/download/release/ remote: NPM_CONFIG_LOGLEVEL=error remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: NODE_V

在向我的服务器添加bookshelf安全密码后,heroku在部署我的服务器时失败,它一直说它无法安装bcrypt

NPM_CONFIG_DISTURL=https://nodejs.org/download/release/
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):  12.14.0
remote:        engines.npm (package.json):   6.13.4
remote:
remote:        Resolving node version 12.14.0...
remote:        Downloading and installing node 12.14.0...
remote:        npm 6.13.4 already installed with node
remote:
remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:
remote:        > bcrypt@3.0.8 install /tmp/build_a26ccc13212d9e4abd4c4c76594f5696/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@3.0.8 install: `node-pre-gyp install --fallback-to-build`
remote:        npm ERR! Exit status 126
remote:        npm ERR!
remote:        npm ERR! Failed at the bcrypt@3.0.8 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.aPY9Y/_logs/2020-03-01T18_03_19_337Z-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://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits

我曾尝试跟踪heroku疑难解答Node.js部署站点,但没有帮助,我曾尝试安装bcrypt,卸载它并安装bcryptjs,但没有帮助,我不知道现在该怎么办,有人能帮忙吗?

即使节点模块不应按评论中所述推送,问题似乎出在节点gyp上,而不是节点_模块本身。 我建议从bcrypt包切换到bcryptjs。它是用js编写的,性能稍差,但它不需要python依赖项,这使得构建过程不那么复杂。API是相同的,所以在代码中更改它是很简单的。这不完全是对你问题的回答,但我希望你觉得它有帮助


我会发表评论,而不是发布答案,但我的声誉不足以做到这一点。

不要推送节点模块,让Heroku为您在dyno中安装它们。我已将节点模块添加到.gitignore文件中,但这无助于您将其从正在推送的提交中删除吗?否则你只会忽略将来对它的更改。好吧,我怎么做?你读过了吗?例如,您提到尝试使用bcryptjs,但可能您推送到存储库的node_模块中仍然有bcrypt包,并且它以某种方式影响了构建过程,即使它没有在package.json中指定。我确实尝试过,正如我在文章末尾提到的,它不起作用,但是删除node_模块起作用