rest-api-nodejs-mongodb icon indicating copy to clipboard operation
rest-api-nodejs-mongodb copied to clipboard

Getting error Error: Cannot find module 'bcrypt'

Open shailesh-vanaliya opened this issue 4 years ago • 4 comments

2021-07-19T09_57_53_633Z-debug.log

I have checked package json file but bcrypt package already available

Error: Cannot find module 'bcrypt' Require stack:

  • E:\angular\kanhashoft\Node-With-Mongo\test\myproject\controllers\AuthController.js
  • E:\angular\kanhashoft\Node-With-Mongo\test\myproject\routes\auth.js
  • E:\angular\kanhashoft\Node-With-Mongo\test\myproject\routes\api.js
  • E:\angular\kanhashoft\Node-With-Mongo\test\myproject\app.js
  • E:\angular\kanhashoft\Node-With-Mongo\test\myproject\bin\www at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at Object. (E:\angular\kanhashoft\Node-With-Mongo\test\myproject\controllers\AuthController.js:7:16) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at Object. (E:\angular\kanhashoft\Node-With-Mongo\test\myproject\routes\auth.js:2:24) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) { code: 'MODULE_NOT_FOUND', requireStack: [ 'E:\angular\kanhashoft\Node-With-Mongo\test\myproject\controllers\AuthController.js', 'E:\angular\kanhashoft\Node-With-Mongo\test\myproject\routes\auth.js', 'E:\angular\kanhashoft\Node-With-Mongo\test\myproject\routes\api.js', 'E:\angular\kanhashoft\Node-With-Mongo\test\myproject\app.js', 'E:\angular\kanhashoft\Node-With-Mongo\test\myproject\bin\www' ] }

shailesh-vanaliya avatar Jul 19 '21 10:07 shailesh-vanaliya

node -v v14.17.2

Mongodb : 5.0.0

shailesh-vanaliya avatar Jul 19 '21 10:07 shailesh-vanaliya

First: npm uninstall bcrypt

second npm install bcrypt

It will install newest bcrypt package.

mrfy avatar Aug 05 '21 19:08 mrfy

You can even use bcryptjs

yugkhokhar avatar Apr 07 '23 18:04 yugkhokhar

The below commands may solve your problem:

npm install node-gyp -g npm install bcrypt -g

npm install bcrypt --save

mdmuhtasimfuadfahim avatar May 07 '23 14:05 mdmuhtasimfuadfahim