简体   繁体   English

Electron项目的本机节点模块针对Linux上错误版本的Node.js进行编译

[英]Native node module for Electron project compiles against the wrong version of Node.js on Linux

I am trying to install this Electron project . 我正在尝试安装这个Electron项目 It uses the two package.json structure and is written for Electron 1.7.2. 它使用两个package.json结构,是为Electron 1.7.2编写的。 All of the dependencies install fine and the setup instructions include running electron-rebuild, which also runs without complaining. 所有依赖项都可以很好地安装,并且安装说明包括运行电子重建程序,该运行程序也不会抱怨。 However, when I run npm run dev an empty window opens and the following is in the console: 但是,当我运行npm run dev ,将打开一个空窗口,并且控制台中包含以下内容:

Uncaught Error: The module '[...]/sciencefair/app/node_modules/webworker-threads/build/Release/WebWorkerThreads.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 51. This version of Node.js requires NODE_MODULE_VERSION 54. 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:173:20) at Object.Module._extensions..node (module.js:598:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at bindings (/[...]/sciencefair/app/node_modules/bindings/bindings.js:76:44) at Object.<anonymous> (/[...]/sciencefair/app/node_modules/webworker-threads/index.js:1:198)

I've tried installing the exact same version of Node.js that Electron 1.7.2 is targetting (7.9.0) but I get the same thing, with and without running electron-rebuild . 我已经尝试安装与Electron 1.7.2定位的完全相同版本的Node.js(7.9.0),但是无论是否运行electron-rebuild ,我都会得到相同的结果。

I'm a web guy and have no real Electron experience. 我是一个网络专家,没有真正的电子经验。 System: Ubuntu LTS 16.04 系统:Ubuntu LTS 16.04

Following the longer answer here did it: 按照更长的答案在这里做到了:

export npm_config_target=1.7.2
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://atom.io/download/electron
export npm_config_runtime=electron
export npm_config_build_from_source=true
HOME=~/.electron-gyp npm install

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

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