绑定错误.模块没有自我注册

Bcrypt Binding Error. Module did not self register?

本文关键字:自我 注册 错误 模块 绑定      更新时间:2023-09-26

所以我试图再次运行我的MEAN stack应用程序,当我进入node server.js时,我得到错误:

/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)

我已经从包中删除了Bcrypt。通过'npm install bcrypt'重新安装。删除并重新安装了/usr/local/lib Nodemon和Npm。还是同样的错误:(

我在实现工作线程时面临同样的问题。在回答这个问题时,加密不支持child_process。我试过'npm I bcrypt@napi -save',一切正常

找到了解决方法:

MAC OSX从/Usr/local/bin中删除Node_modules文件夹重新安装稳定节点版本全局安装NPM通过NPM全局安装nodemon从应用中删除旧的node-modules文件夹,并重新安装。