Node.bcrypt.js: gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/build'

Created on 9 May 2019  路  4Comments  路  Source: kelektiv/node.bcrypt.js

  • What went wrong?
    Unable to install bcrypt v3.0.4 successfully using npm install command.
macusers-MacBook:RESTfulAPITutorial-password-reset HighSierra$ sudo npm install

> [email protected] install /Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib' 
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/build'
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/Test/Desktop/REST
fulAPITutorial-password-reset/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt
gyp ERR! node -v v11.14.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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-buil
d --module=/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v6
7' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:999:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
node-pre-gyp ERR! System Darwin 18.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt
node-pre-gyp ERR! node -v v11.14.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/Test/Desktop/RESTfulAPITutorial-password-reset/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
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!     /Users/Test/.npm/_logs/2019-05-09T04_44_51_945Z-debug.log
  • What did you expect to happen?
    Install bcrypt V3.0.4 successfully.

  • Which version of nodejs and OS?
    Node.js Version: v11.14.0
    macOS Version: v10.14.4 Mojave
    Bcrypt Version: v3.0.4

Most helpful comment

the solution is : sudo npm cache clean -f; sudo npm install -g n; sudo n stable;
"sudo npm cache clean -f; sudo npm install -g n; sudo n stable;" is to update npm and node it should work afterwards

All 4 comments

Is this still an issue? If so, have you tried it on the latest version of node / Node 12? Can this be marked as resolved?

Is there a solution to this other than running the latest version of node.. isn't is supposed to run on version 10?

the solution is : sudo npm cache clean -f; sudo npm install -g n; sudo n stable;
"sudo npm cache clean -f; sudo npm install -g n; sudo n stable;" is to update npm and node it should work afterwards

You need to make sure that the directory has proper permissions. Using sudo with npm is a bad idea.

Was this page helpful?
0 / 5 - 0 ratings