Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while installing bycrpt in nodejs? whenever i run npm install install --save?

> [email protected] 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 [email protected] and [email protected] (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` [email protected] No repository field.
`npm WARN` optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
`npm WARN` notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

`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!`     C:\Users\adity\AppData\Roaming\npm-cache\_logs\2018-07-07T10_51_34_631Z-debug.log```
like image 566
aditya kumar Avatar asked Dec 18 '25 10:12

aditya kumar


2 Answers

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
like image 118
Konrad Linkowski Avatar answered Dec 20 '25 01:12

Konrad Linkowski


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.

like image 22
mrSerious Avatar answered Dec 19 '25 23:12

mrSerious



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!