NODE_MODULE_VERSION 46. This version of Node.js requires NODE_MODULE_VERSION 64. Please try re-compiling or re-installing

白昼怎懂夜的黑 提交于 2019-12-22 10:39:53

问题


I am trying to execute a node app which was provided to me and it is supposed to work fine.

I have tried running it but I am not able to fix this error:

seba@vps92941:~/services/drivetech$ node awto.js
/home/seba/services/drivetech/node_modules/bindings/bindings.js:83
        throw e
        ^

Error: The module '/home/seba/services/drivetech/node_modules/zmq/build/Release/zmq.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 64. 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:731:18)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at bindings (/home/seba/services/drivetech/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/home/seba/services/drivetech/node_modules/zmq/lib/index.js:6:30)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)

I have already tried :

  • Re-building the module (zmq)
  • Removing and re-installing the module
  • Uninstall everything (node included), install again
  • Re-building zmq as global module

How can I get rid of this? I don't know what else to do.

These are my node & npm versions:

node: v10.4.0
npm: 3.5.2


回答1:


I had the same exact problem with bcrypt moving from node 8 to node 10 and finally I solved by manually invoking node-pre-gyp:

cd node_modules/<module_name>
node-pre-gyp rebuild

This forced the node-pre-gyp tool (the tool used by node to compila binary modules) to take the correct version of node.

Maybe reinstall it before executing to be sure that you have the correct version of node-pre-gyp

npm i -g node-pre-gyp

Hope this helps



来源:https://stackoverflow.com/questions/50805005/node-module-version-46-this-version-of-node-js-requires-node-module-version-64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!