从节点8升级到节点10:关于“针对不同Node.js版本编译的模块”的错误

时间:2018-11-13 16:31:27

标签: node.js

运行节点应用程序时出现以下错误。它仅在我从node 8.12.0升级到node 10.13.0(现在为“ recommended for most users”)之后才发生。问题似乎与node-expat有关,我不直接使用它,而是xml2json的依赖项(我要做直接使用)。

/root/workspace/myapp/node_modules/bindings/bindings.js:88
        throw e
        ^

Error: The module '/root/workspace/myapp/node_modules/node-expat/build/Release/node_expat.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (module.js:682:18)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at bindings (/root/workspace/myapp/node_modules/bindings/bindings.js:81:44)
    at Object.<anonymous> (/root/workspace/myapp/node_modules/node-expat/lib/node-expat.js:4:32)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)

该如何解决?是的,我已经按照this thread的要求完全删除了node_modules并完成了npm install……无济于事。

0 个答案:

没有答案