简体   繁体   中英

Node module version conflict while developing package for Atom

I'm developing my first package for Atom. To do it, I need this package nodegit ( here the official website ).

When I try to run my package, I get this error:

The module '/Users/danny/github/branch-control/node_modules/nodegit/build/Release   
/nodegit.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. 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`).

I already tried to look online but none of the solutions I found solved my problem.

I tried with npm rebuild , npm rebuild nodegit , I tried to install it with --update-binary and I tried with different node versions, without success.

Moreover it says NODE_MODULE_VERSION 69 , but there is no version 69 in the node releases, it goes from 64 to 72 directly.

I found online that this 69 refers to the node version that electron uses, but I think I can not change it, because it's the version that Atom uses.

How can I solve this and go on?

This is my environment:

  • macOS Catalina 10.15
  • Atom 1.44.0
    • Electron 4.2.7
    • Chrome 69
    • Node 10.11.0

You need to use electron-rebuild for this.

From the README:

This executable rebuilds native Node.js modules against the version of Node.js that your Electron project is using. This allows you to use native Node.js modules in Electron apps without your system version of Node.js matching exactly (which is often not the case, and sometimes not even possible).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM