本文介绍了Nodejs Bcrypt + Heroku部署失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在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)

       > [email protected] 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! [email protected] install: `node-pre-gyp install --fallback-to-build`
       npm ERR! Exit status 1
       npm ERR!
       npm ERR! Failed at the [email protected] 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.

尝试并执行 heroku建议 ,在package.json上定义您正在使用的节点版本.

Try and do what heroku suggest, define the node version you are using on the package.json.

获取用于开发的版本:

node --version

然后将其放在package.json上:

{ "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
      "node": "8.9.4"
   }
}

这篇关于Nodejs Bcrypt + Heroku部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 03:01