npm - “Failed to load gRPC binary module because it was not installed for the current system”仅在Windows上

标签 npm electron

尝试在Windows上运行打包的应用程序时出现上述错误。它在linux上运行良好。

Expected directory: electron-v2.0-win32-ia32-unknown
Found: node-v57-linux-x64-glibc

这是预期目录应该位于的位置:
"/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node"

package.json
    "dependencies": {
    "electron": "^2.0.10",
    "firebase": "^5.5.2",
    "material-design-lite": "^1.3.0"
  },
  "devDependencies": {
    "electron-packager": "^12.2.0",
    "electron-rebuild": "^1.8.2"
  }

我尝试过的事情:
  • 重新安装
  • This question

  • 让我知道您是否需要其他详细信息。

    最佳答案

    您必须重新构建您的Electron版本的软件包。
    例如,这是我用来为我的Electron App重建C++包的命令:

    npm rebuild --runtime=electron --target=2.0.11 --disturl=https://atom.io/download/electron --abi=57
    

    您必须说要npm重建运行时(在这种情况下为Electron),所需的版本目标(在我的情况下为2.0.11),disturl用于下载Electron发行版,最后是您的Electron版本的ABI(您可以获取使用以下命令:electron --abi)

    希望这可以帮到你 :)

    [编辑]

    这是在全局中安装带有Electron的ABI版本的命令:
    Screenshot Electron

    或者在这里,当我想要在我的项目中安装Electron版本和ABI时:
    Screenshot Electron

    关于npm - “Failed to load gRPC binary module because it was not installed for the current system”仅在Windows上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53276898/

    相关文章:

    reactjs - create-react-app 自 4.0.1 版起不起作用

    npm - 如何修复Electron中的 “spawn UNKNOWN”错误?

    printing - 数据表:打印在Angular 9和Electron中不起作用

    javascript - Electron 生成器 : Not allowed to load local resource: app. asar/build/index.html

    reactjs - Webpack 4 devtool 选项不适用于 webpack-dev-server

    node.js - 如何在 npm 中升级全局包的依赖项

    npm - Gulp:我需要 package.json 吗?

    node.js 错误 : Cannot find module 'lodash.assign'

    node.js - 带有strapi的 Electron ,找不到模块package.json

    node.js - 使用交叉应用程序识别前台应用程序