如何解决“不同的NODE_MODULE_VERSION”?

时间:2019-06-10 14:48:26

标签: node.js

我正在终端上运行节点应用程序并收到错误消息:

Error: The module '\\?\C:\Users\zMaChaoz\Documents\New folder\DoAnWeb\node_modules\bcrypt\lib\binding\bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:800:18)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (C:\Users\zMaChaoz\Documents\New folder\DoAnWeb\node_modules\bcrypt\bcrypt.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)

有什么办法解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

运行此命令npm@latest -g

答案 1 :(得分:0)

您尝试过npm rebuild吗?有时您必须重建特定的模块,例如:npm rebuild node-sass