0

So I'm trying to run my MEAN stack app again and when I enter node server.js, I get error:

/Users/<myusername>/Desktop/Wardrobe_fairy (Update)/api/node_modules/bcrypt/node_modules/bindings/bindings.js:83
        throw e
        ^

Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:434:18)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at bindings (/Users/username/Desktop/Wardrobe_fairy (Update)/api/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/Users/username/Desktop/Wardrobe_fairy (Update)/api/node_modules/bcrypt/bcrypt.js:3:35)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/username/Desktop/Wardrobe_fairy (Update)/api/models/user.js:2:12)
    at Module._compile (module.js:409:26)

I've deleted Bcrypt from Package.json and installed again through 'npm install bcrypt' Deleted and reinstalled /usr/local/lib Nodemon and Npm. Still the same error :(

Ramish Mian
  • 137
  • 1
  • 2
  • 13

2 Answers2

1

I was facing the same issue while implementing worker thread. At the time of answering this bcrypt does n't support child_process. I have tried 'npm i bcrypt@napi --save' everything worked fine.

Yoga
  • 491
  • 5
  • 8
0

Figured out how to work around it:

MAC OSX Removed Node_modules folder from /Usr/local/bin Reinstalled stable node version global install npm install nodemon through npm globally delete old node-modules folder from the app and fresh sudo npm install.

It worked then.

Ramish Mian
  • 137
  • 1
  • 2
  • 13