Question:
Npm fails to install bcrypt node-pre-gyp

Problem:

When I try to run npm I bcrypt i get the folowing errors


PS C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-api> npm i bcrypt

npm ERR! code 1

npm ERR! path C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\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.9.0 | win32 | x64

npm ERR! node-pre-gyp info check checked for "C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\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 WARN Pre-built binaries not installable for bcrypt@5.1.1 and node@20.9.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp)

npm ERR! node-pre-gyp WARN Hit error ENOENT: no such file or directory, open 'C:\Certs\root_ca.pem'

npm ERR! gyp info it worked if it ends with ok

npm ERR! gyp info using node-gyp@9.4.0

npm ERR! gyp info using node@20.9.0 | 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@9.4.0

npm ERR! gyp info using node@20.9.0 | win32 | x64

npm ERR! gyp info find Python using Python version 3.11.5 found at "C:\Python311\python.exe"

npm ERR! gyp http GET https://nodejs.org/download/release/v20.9.0/node-v20.9.0-headers.tar.gz

npm ERR! gyp WARN install got an error, rolling back install

npm ERR! gyp ERR! configure error

npm ERR! gyp ERR! stack Error: ENOENT: no such file or directory, open 'C:\Certs\root_ca.pem'

npm ERR! gyp ERR! System Windows_NT 10.0.22621

npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Barth\\OneDrive\\Bureaublad\\School\\Semester 6\\Individual project\\Stat-Tracker-Application\\Authentication-Api\\node_modules\\bcrypt\\lib\\binding\\napi-v3\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\Barth\\OneDrive\\Bureaublad\\School\\Semester 6\\Individual project\\Stat-Tracker-Application\\Authentication-Api\\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\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\node_modules\bcrypt

npm ERR! gyp ERR! node -v v20.9.0

npm ERR! gyp ERR! node-gyp -v v9.4.0

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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\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.<anonymous> (C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)

npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514: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.22621

npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Barth\\OneDrive\\Bureaublad\\School\\Semester 6\\Individual project\\Stat-Tracker-Application\\Authentication-Api\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"

npm ERR! node-pre-gyp ERR! cwd C:\Users\Barth\OneDrive\Bureaublad\School\Semester 6\Individual project\Stat-Tracker-Application\Authentication-Api\node_modules\bcrypt

npm ERR! node-pre-gyp ERR! node -v v20.9.0

npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11

npm ERR! node-pre-gyp ERR! not ok


It seems related to it not being able to find a file called root_ca.pem why is it even looking for this what environment variable did I mess up and how do I fix it


Solution:

>Check this out

The easy solution is just switch from the "bcrypt" npm module to >bcryptjs or >bcrypt-nodejs. It's the exact same API, but pure JS so no native add-ons to deal with.


npm install --save bcryptjs && npm uninstall --save bcrypt


Then change your require calls to "bcryptjs", but all your code otherwise can be unchanged.

Long term, I suspect at the moment bcrypt may not be ready for node v0.12.0 yet, but if not it will eventually be updated and ready.


Suggested blogs:

>What makes index.html have such kind of name in Django?

>Fix Module Not Found during deployment- Django

>Creating a Django with existing directories, files etc.?

>Fix Module Not Found Error in Django

>How to create a to-do list for users, with only incomplete tasks in Django?

>How to populate Django Quill Field from ORM

>How to test the post-Django function?

>How to filter events by month in Django?

>Implement nested serializers in the Django rest framework


Ritu Singh

Ritu Singh

Submit
0 Answers