kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.38k stars 509 forks source link

having issue installing bcrypt #1028

Open Charleyme opened 3 months ago

Charleyme commented 3 months ago

$ npm i bcrypt npm ERR! code 1 npm ERR! path C:\Users\P\downloads\treb\authentication\node_modules\bcrypt npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --modu le=C:\Users\P\downloads\treb\authentication\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\P\downloads\treb\authentication\node_modules \bcrypt\lib\binding\napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11 npm ERR! node-pre-gyp info using node@20.11.1 | win32 | x64 npm ERR! node-pre-gyp info check checked for "C:\Users\P\downloads\treb\authentication\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" (not found) npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.1.1/bcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz npm ERR! node-pre-gyp ERR! install request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/611333/97a8321c-5d46-45ec-b4ee-95fc5d5053fb?X-Amz-Algorithm=AWS4-HMAC -SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240324%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240324T210303Z&X-Amz-Expires=300&X-Amz-Signature=86f8314342c6014c1f62a3555da86fa9dc8ad9c2f 5b742ace115a3507088ab9f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=611333&response-content-disposition=attachment%3B%20filename%3Dbcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz&r esponse-content-type=application%2Foctet-stream failed, reason: read ECONNRESET npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.1.1 and node@20.11.1 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) npm ERR! node-pre-gyp WARN Hit error request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/611333/97a8321c-5d46-45ec-b4ee-95fc5d5053fb?X-Amz-Algorithm=AWS4-HM AC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240324%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240324T210303Z&X-Amz-Expires=300&X-Amz-Signature=86f8314342c6014c1f62a3555da86fa9dc8ad9c 2f5b742ace115a3507088ab9f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=611333&response-content-disposition=attachment%3B%20filename%3Dbcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz &response-content-type=application%2Foctet-stream failed, reason: read ECONNRESET npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@10.0.1 npm ERR! gyp info using node@20.11.1 | win32 | x64 npm ERR! gyp info ok npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@10.0.1 npm ERR! gyp info using node@20.11.1 | win32 | x64 npm ERR! gyp info find Python using Python version 3.12.2 found at "C:\Users\P\python\python.exe" npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/win-x64/node.lib npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/win-x64/node.lib npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18 npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS ** npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload. npm ERR! gyp ERR! find VS For more information consult the documentation at: npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows npm ERR! gyp ERR! find VS ** npm ERR! gyp ERR! find VS npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:113:11) npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio (C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:69:17) npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5) npm ERR! gyp ERR! stack at async createBuildDir (C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\lib\configure.js:69:26) npm ERR! gyp ERR! stack at async run (C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js:81:18) npm ERR! gyp ERR! System Windows_NT 10.0.19045 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fall back-to-build" "--module=C:\Users\P\downloads\treb\authentication\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\Users\P\do wnloads\treb\authentication\node_modules\bcrypt\lib\binding\napi-v3" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3" npm ERR! gyp ERR! cwd C:\Users\P\downloads\treb\authentication\node_modules\bcrypt npm ERR! gyp ERR! node -v v20.11.1 npm ERR! gyp ERR! node-gyp -v v10.0.1 npm ERR! gyp ERR! not ok npm ERR! node-pre-gyp ERR! build error npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\P\AppData\Roaming\nvm\v20.11.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js confi gure --fallback-to-build --module=C:\Users\P\downloads\treb\authentication\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\P\downloads\t reb\authentication\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess. (C:\Users\P\Downloads\TREB\Authentication\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28) npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045 npm ERR! node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\P\Downloads\TREB\Authentication\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "install" "--fa llback-to-build" npm ERR! node-pre-gyp ERR! cwd C:\Users\P\downloads\treb\authentication\node_modules\bcrypt npm ERR! node-pre-gyp ERR! node -v v20.11.1 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: C:\Users\P\AppData\Local\npm-cache_logs\2024-03-24T21_03_37_640Z-debug-0.log

sushant1123 commented 3 months ago

bcrypt library requires you to install an additional compiler. Ensure you have installed Python ^2, a C++ compiler, and a make system in your machine before installing bcrypt.

If you don't want to install all these dependencies, check this library bcryptjs. Performance is not up to the mark but it does the job of hashing.

npm install --save bcryptjs

This worked for me in 2024.