-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot find module '...../bcrypt/lib/binding/napi-v3/bcrypt_lib.node' #800
Comments
Ok for anyone else having this issue here is how I solved it, I had to compile it manually for some reason: |
|
It solves my problem too. Thanks. |
sudo npm i --unsafe-perm its works for me ubuntu 18.04 |
This works for me on newly installation on Windows 10/VSC, nodeJS v14.15.1. Thanks a lot! |
It helps me. Thanks |
if mac still have problems after |
node version: 14.16.0 (LTS) I get the following error: internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module '...path...\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node'
Require stack:
- ...path...\node_modules\bcrypt\bcrypt.js
- ...path...\crypto.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (...path...\node_modules\bcrypt\bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'...path...\\node_modules\\bcrypt\\bcrypt.js',
'...path...\\crypto.js'
]
} I have tried the fixes here and here and haven't been able to resolve the issue. |
@Shishoo it appears that your bcrypt DLL is missing. Run |
@recrsn |
What's the error while trying to rebuild? Do you have an outer layer of package.json? |
There is NO error when I run Here is everything I have encountered and contained within the project directory: ----------------------------------------------------
> npm i bcrypt
----------------------------------------------------
npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN bcrypto@1.0.0 No description
npm WARN bcrypto@1.0.0 No repository field.
+ bcrypt@5.0.0
added 68 packages from 116 contributors and audited 68 packages in 13.075s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
--------------------------------------------------
> node app.js
----------------------------------------------------
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'F:\...path-to-file\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node'
Require stack:
- F:\...path-to-file\bcrypto\node_modules\bcrypt\bcrypt.js
- F:\...path-to-file\bcrypto\app.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (F:\...path-to-file\node_modules\bcrypt\bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'F:\\...path-to-file\\node_modules\\bcrypt\\bcrypt.js',
'F:\\...path-to-file\\bcrypto\\app.js'
]
}
----------------------------------------------------
> npm rebuild bcrypt
----------------------------------------------------
bcrypt@5.0.0 F:\...path-to-file\bcrypto\node_modules\bcrypt
**(No errors or warnings)**
----------------------------------------------------
> node app.js
----------------------------------------------------
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'F:\...path-to-file\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node'
Require stack:
- F:\...path-to-file\bcrypto\node_modules\bcrypt\bcrypt.js
- F:\...path-to-file\bcrypto\app.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (F:\...path-to-file\node_modules\bcrypt\bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'F:\\...path-to-file\\node_modules\\bcrypt\\bcrypt.js',
'F:\\...path-to-file\\bcrypto\\app.js'
]
}
----------------------------------------------------
contents of: package.json
----------------------------------------------------
{
"name": "bcrypto",
"version": "1.0.0",
"description": "testing bcrypt",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.0"
}
}
----------------------------------------------------
contents of: app.js
----------------------------------------------------
// REF: https://www.npmjs.com/package/bcrypt
const bcrypt = require('bcrypt');
pwd = '£MonkeyMa9ic';
const hashPassword = async (pwd) => {
const salt = await bcrypt.genSalt(11);
const hash = await bcrypt.hash(pwd, salt)
console.log(salt);
console.log(hash);
}; |
Below solved the issue:
|
Thanks man! That helped solve the error. |
The only answer online that eventually helped me :) |
not work me |
I fixed this issue this way. On the terminal from root folder of the project: |
This solved the issue. Thanks a lot. |
Solved my issue |
ça à aussi fonctionner pour moi et je suis sur Mac os |
This worked for me |
i use pnpm and node.js@18.16.0. |
save my day, thank you sir! |
Big thanks, works for me |
I was missing |
this work for me, for macbook air m1 |
This is (still) occurring on
|
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.
The text was updated successfully, but these errors were encountered: