node.bcrypt.js: Error: Cannot find module '...../bcrypt/lib/binding/napi-v3/bcrypt_lib.node'
After installing the newest version of node 12.6.3 and installing bcrypt 4.0.1 in my project, “npm install bcrypt” added the package successfully without errors, but then running “node app.js” I get:
Error: Cannot find module 'path_to_my_project/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node'
And indeed the folder node_modules/bcrypt/lib is not there at all…
Why would installation not make this folder? I suspect it’s something to do with node-gyp not doing it’s thing, but why don’t I get an error message when i do npm install?
And I tried reverting to my old node version 8.11.1 using https://www.npmjs.com/package/n to manage my node versions and then installing bcrypt 2.0.1 (like I had previously), but it’s behaving the exact same way… npm install adds the package but the bcrypt/lib folder is missing. I also tried with node 12.6.1 and 12.6.2, same thing.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 26
Ok for anyone else having this issue here is how I solved it, I had to compile it manually for some reason:
cd node_modules/bcryptnode-pre-gyp install --fallback-to-buildBelow solved the issue:
node_modules, or renamenode_modulesto something elsenpm cache clean --forcenpm i@Shishoo it appears that your bcrypt DLL is missing. Run
npm rebuild bcryptI fixed this issue this way. On the terminal from root folder of the project: cd node_modules/bcrypt make
@recrsn Hi Amitosh - with reference to your previous post here on 27/12/2017, I did try
npm rebuild bcrypt- unfortunately this didn’t work.sudo npm i --unsafe-perm after that install bcrypt
its works for me ubuntu 18.04
It solves my problem too. Thanks.
I was missing
node-gypon my system, after installing it and rebuilding like told by @recrsnnpm rebuild bcryptthis solved my issueSolved my issue
The only answer online that eventually helped me 😃
@recrsn
There is NO error when I run
npm rebuild bcryptHere is everything I have encountered and contained within the project directory:
It helps me. Thanks
This works for me on newly installation on Windows 10/VSC, nodeJS v14.15.1. Thanks a lot!