简体   繁体   English

为 Atom 开发包时节点模块版本冲突

[英]Node module version conflict while developing package for Atom

I'm developing my first package for Atom.我正在为 Atom 开发我的第一个包。 To do it, I need this package nodegit ( here the official website ).为此,我需要这个包nodegit这里是官方网站)。

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.我尝试使用npm rebuildnpm rebuild nodegit ,我尝试使用--update-binary安装它,并尝试使用不同的节点版本,但没有成功。

Moreover it says NODE_MODULE_VERSION 69 , but there is no version 69 in the node releases, it goes from 64 to 72 directly.而且它说NODE_MODULE_VERSION 69 ,但是节点版本中没有版本69 ,它直接从6472

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.网上查到这个69指的是electron使用的node版本,但是我觉得不能改,因为是Atom使用的版本。

How can I solve this and go on?我该如何解决并继续?

This is my environment:这是我的环境:

  • macOS Catalina 10.15 macOS Catalina 10.15
  • Atom 1.44.0原子 1.44.0
    • Electron 4.2.7电子 4.2.7
    • Chrome 69铬 69
    • Node 10.11.0节点 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.此可执行文件根据您的 Electron 项目正在使用的 Node.js 版本重建原生 Node.js 模块。 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).这允许您在 Electron 应用程序中使用原生 Node.js 模块,而无需您的 Node.js 系统版本完全匹配(通常情况并非如此,有时甚至不可能)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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