【发布时间】:2019-10-04 06:16:00
【问题描述】:
如何使用 NODE_MODULE_VERSION 46 安装 Node.js 版本?我一直遇到 NODE_MODULE_VERSION 不匹配的问题,并且重新编译没有帮助,因此切换节点版本可能更容易。
基本上,我经常遇到这种情况:
Warning: The module '/home/cwaugh/workspaces/myproject/build/Release/addon.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. 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`). Use --force to continue.
到目前为止,我已尝试使用 n 更改为不同的版本(我的依赖项之一需要 4.9.1 或更低版本),但这似乎并没有改变警告所识别的 NODE_MODULE_VERSION。
我也试过重新编译:
- 我尝试删除 node_modules 并再次运行
npm install。 (这个错误看起来像是来自项目根目录,但它也从未对 node_modules 文件夹中的任何内容起作用) -
node-gyp configure --target=4.9.1 && node-gyp build --target=4.9.1。我从here 得到了这个想法,希望我的运气比 mxcd 好。 -
node-pre-gyp rebuild。我看到了this,并认为它可能对我有用。
这适用于另一台运行 vagrant 映像的旧计算机。不幸的是,vagrant 也没有在新电脑上工作,所以我一直在从头开始尝试。有时,我想知道是不是因为我使用的是 Ubuntu 18.04。服务器在运行我们的 docker 映像时似乎无法超过 16.04。
【问题讨论】:
-
我要改变它。当我升级我的 nan 版本时,我能够使用 npm 6.17.1,这将消息更改为
compiled against a different Node.js version using NODE_MODULES_ 48
标签: npm installation version