3
> bcrypt@3.0.0 install C:\projects\alecadApi\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

`node-pre-gyp` WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-win32-x64-unknown.tar.gz
`node-pre-gyp` WARN Pre-built binaries not found for bcrypt@3.0.0 and node@8.10.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
`C:\projects\alecadApi\node_modules\bcrypt\build\bcrypt_lib.vcxproj(20,3)`: error MSB4019: The imported project "C:\Microsoft.Cp
p.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk
.
`gyp ERR!` build error
`gyp ERR!` stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258: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 Windows_NT 10.0.17134
`gyp ERR!` command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\adity\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\projects\\alecadApi\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\projects\\alecadApi\\node_modules\\bcrypt\\lib\\binding" "--napi_version=1" "--node_abi_napi=napi"
`gyp ERR!` cwd C:\projects\alecadApi\node_modules\bcrypt
`gyp ERR`! node -v v8.10.0
`gyp ERR!` node-gyp -v v3.6.2
`gyp ERR!` not ok
`node-pre-gyp` ERR! build error
`node-pre-gyp` ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\alecadApi\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\alecadApi\node_modules\bcrypt\lib\binding --napi_version=1 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Projects\alecadApi\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:925:16)
`node-pre-gyp` ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
`node-pre-gyp` ERR! System Windows_NT 10.0.17134
`node-pre-gyp` ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Projects\\alecadApi\\node_modules\\bcrypt\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
`node-pre-gyp` ERR! cwd C:\projects\alecadApi\node_modules\bcrypt
`node-pre-gyp` ERR! node -v v8.10.0
`node-pre-gyp` ERR! node-pre-gyp -v v0.10.2
`node-pre-gyp` ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\alecadApi\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\alecadApi\node_modules\bcrypt\lib\binding --napi_version=1 --node_abi_napi=napi' (1)
`npm WARN` alecadApi@1.0.0 No repository field.
`npm WARN` optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
`npm WARN` notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

`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!`     C:\Users\adity\AppData\Roaming\npm-cache\_logs\2018-07-07T10_51_34_631Z-debug.log```
Tenzin Chemi
  • 5,101
  • 2
  • 27
  • 33
aditya kumar
  • 2,905
  • 10
  • 39
  • 79

6 Answers6

5

You should use

npm install --save bcrypt

for a proper installation.

By the way to use bcrypt you need python installed. If you want be python-independent use bcryptjs

npm install --save bcryptjs
Konrad
  • 21,590
  • 4
  • 28
  • 64
5

Have you tried this?

Open powershell with administrator privileges and run this command, then proceed with bcrypt installation.

npm install --global --production windows-build-tools

Note: Wait until you see "All Done!" on the powershell window and then proceed to install the module.

mrSerious
  • 74
  • 1
  • 5
  • This solved my problem perfectly. windows-build-tools supports all pure C++ addons for Node.js Those are: node-sass, bcrypt, sqlite3, serialport, websocket, deasync, grpc, canvas, sharp, hiredis, leveldown, nodegit, zqm, ffi, libxmljs, iconv, ref, sleep, microtime, couchbase, bignum, kerberos, and ursa. – Jaskaran Singh Apr 17 '21 at 09:18
  • Happy to hear this. :) – mrSerious Jun 04 '22 at 11:50
2

You need to install bcrypt separately.

do npm install bcrypt --save and after this is done, run npm install again.

You can also check out this link for an answer to a similar question.

Alternatively, if this doesn't work, you can use bcrypt-nodejs or bcryptjs package.

itaintme
  • 1,575
  • 8
  • 22
2

For some that may encounter that

Case

If you were able to install correctly before. Then after upgrading your nodejs (for me i went from 11 to 12) you become unable.

If you get

was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

an error like that. And then when you run npm rebuild you end up with other errors.

Solution that can work (did for me)

Remove completly bcrypt. (remove from package.json then npm install --save).

Then reinstall again

npm install bcrypt --save 

It installed correctly and build up with no problem.

(You may omit the remove part).

Mohamed Allal
  • 17,920
  • 5
  • 94
  • 97
2

try with this version ..its working for me ... npm i bcrypt@3.0.6

satywan kumar
  • 207
  • 2
  • 3
0

I was facing this issue because of my node js version 12.8.3. I just changed my node version to 12.4.1. And then try to install bcrypt using npm i bcrypt. Now its working fine for me.

Check/Download Different Node.js version from this Link

Pulkit Aggarwal
  • 2,554
  • 4
  • 23
  • 33