Nodejs Bcrypt + Heroku 部署失败 [英] Nodejs Bcrypt + Heroku fail deploy
问题描述
当我尝试在 heroku 中进行部署时遇到问题.有趣的是,这是三天前的工作.此外,在本地机器上工作正常.
i am having problems when i try to do a deployment in heroku. The funny part is this was working three days ago. Also, is working fine in local machine.
Bcrypt版本为3.0.0,节点8.12.0
The version of Bcrypt is 3.0.0, node 8.12.0
我真的需要部署这个服务器.你能告诉我如何解决这个错误吗?我尝试了一些我找到的解决方案,但没有任何效果.我什至尝试卸载并重新安装 Bcrypt 但不起作用.
I really need to deploy this server. Could you please show me how to fix this error? I have tried some solutions I found but nothing worked. I even tried to uninstall and install again Bcrypt but does not work.
感谢您的帮助.
这是日志.
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 8.x...
Downloading and installing node 8.12.0...
Using default npm version: 6.4.1
-----> Restoring cache
- node_modules
-----> Building dependencies
Installing node modules (package.json + package-lock)
> bcrypt@3.0.0 install /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
make: Entering directory '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/build'
make: Entering directory '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
make: Leaving directory '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-1027-aws
gyp ERR! command "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/bin/node" "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/bin/node /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.4.0-1027-aws
node-pre-gyp ERR! command "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/bin/node" "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! not ok
Failed to execute '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/bin/node /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
../src/bcrypt.cc:316:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
compilation terminated.
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt.o] Error 1
make: Leaving directory '/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-1027-aws
gyp ERR! command "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/bin/node" "/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /tmp/build_7bec2ec99162a9fbf0c48b54d7fcf7ea/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@3.0.0 install 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.FCizS/_logs/2018-09-12T04_21_02_165Z-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
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
推荐答案
同样的事情发生在我身上.
Had the same thing happening to me.
package.json 中未指定节点版本
Node version not specified in package.json
尝试做heroku 建议,定义您在 package.json
上使用的节点版本.
Try and do what heroku suggest, define the node version you are using on the package.json
.
获取您用于开发的版本:
Get the version you are using for development:
node --version
然后放到package.json
上:
{ "name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "8.9.4"
}
}
这篇关于Nodejs Bcrypt + Heroku 部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!