【问题标题】:Native node module for Electron project compiles against the wrong version of Node.js on LinuxElectron 项目的本机节点模块在 Linux 上针对错误版本的 Node.js 进行编译
【发布时间】:2017-12-07 04:34:13
【问题描述】:

我正在尝试安装this Electron project。它使用两个 package.json 结构并且是为 Electron 1.7.2 编写的。所有依赖项都安装得很好,setup instructions 包括运行 electron-rebuild,它也可以毫无怨言地运行。但是,当我运行 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)

我尝试安装与 Electron 1.7.2 所针对的完全相同版本的 Node.js (7.9.0),但无论是否运行 electron-rebuild,我都得到了相同的结果。

我是一个网络人,没有真正的 Electron 经验。系统:Ubuntu LTS 16.04

【问题讨论】:

    标签: javascript node.js npm electron ubuntu-16.04


    【解决方案1】:

    按照更长的答案here做到了:

    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
    

    【讨论】:

      猜你喜欢
      • 2019-07-28
      • 2021-02-19
      • 1970-01-01
      • 2020-01-09
      • 1970-01-01
      • 1970-01-01
      • 2022-11-01
      • 1970-01-01
      • 2012-11-21
      相关资源
      最近更新 更多