Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

node.js - Nodejs Bcrypt + Heroku fail deploy

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.

The version of Bcrypt is 3.0.0, node 8.12.0

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.

Thanks for the help.

This is the log.

-----> 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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Had the same thing happening to me.

Node version not specified in 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

Then put it on package.json:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...