xmppo / node-expat

libexpat XML SAX parser binding for node.js
https://github.com/xmppo/node-expat
MIT License
385 stars 97 forks source link

NODE_MODULE_VERSION error #185

Open pamarti opened 6 years ago

pamarti commented 6 years ago

/node_modules/node-expat/build/Release/node_expat.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 59. 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).

node-expat : 2.3.16 node: 8.10 npm: 5.6 electron: 1.8.4

I also used electron-rebuild to build the package to new target node version I also used node-gyp to rebuild node-expat. Nothing helped.

Any ideas to fix this issue?

8BitJonny commented 6 years ago

Same Issue here

drmrbrewer commented 6 years ago

Same here. Any solution to this? It occurred after I upgrade from node 8.12.0 to node 10.13.0. I am using node-expat via xml2json. The error I get is when I run my node app:

/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)
catin-black commented 5 years ago

+1

lfuelling commented 5 years ago

I have the same problem. I tried building on 8.x, 10.x and 11.x. I am also using node-expat only as dependency of xml2json.

Error: The module 'node_modules/node-expat/build/Release/node_expat.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 69. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Module.require (internal/modules/cjs/loader.js:640:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at bindings (node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (node_modules/node-expat/lib/node-expat.js:4:32)

EDIT: I solved my problem. Apparently electron sets this value higher than the current latest. I had to add electron-rebuild as postinstall hook which in turn compiled node-expat with the correct version.

Sashlyn commented 5 years ago

Has anyone found a solution to this outside of electron? I've got the exact same issue as the OP but running on an Ubuntu server.

hefc2016 commented 4 years ago

I have same error with node-expat.

<Error: The module '/home/hefc/GIT/xviz/examples/converters/kitti/node_modules/node-expat/build/Release/node_expat.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 46. This version of Node.js requires NODE_MODULE_VERSION 67. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).>

Could anyone who fixed this issue share the solution ouside elelctron?

sriramtorvi commented 4 years ago

I had the same issue Downgrading the node version and running npm rebuild helped me.

miklcct commented 6 months ago

same issue here

miklcct commented 6 months ago

Running npm rebuild helped me, but what is the equivalent on yarn?