node.js - 问题将 Firebase 添加到 Electron 项目,gRPC 依赖问题

标签 node.js firebase electron

我已经遇到这个问题好几天了,一直没能找到解决办法。根据我的研究,这似乎是一个已知问题,但所提供的修复程序均不适用于我的情况。

我试过:

npm rebuild

npm install grpc --runtime=electron --target=1.7.6

我尝试的另一件事是将其添加到 package.json 文件中:

  "resolutions": {
    "grpc": "^1.12.0"
  },

此外,我尝试过上下更改 electron、grpc、firebase 的版本。

我在控制台上不断收到的错误是:

E:\GitHub\Portfolio-Manager\node_modules\grpc\src\grpc_extension.js:53 Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
    Expected directory: electron-v1.7-win32-x64-unknown
    Found: [node-v59-win32-x64-unknown]
    This problem can often be fixed by running "npm rebuild" on the current system
    Original error: Cannot find module 'E:\GitHub\Portfolio-Manager\node_modules\grpc\src\node\extension_binary\electron-v1.7-win32-x64-unknown\grpc_node.node'
        at Object.<anonymous> (E:\GitHub\Portfolio-Manager\node_modules\grpc\src\grpc_extension.js:53)
        at Object.<anonymous> (E:\GitHub\Portfolio-Manager\node_modules\grpc\src\grpc_extension.js:63)
        at Module._compile (VM129 module.js:571)
        at Object.Module._extensions..js (VM129 module.js:580)
        at Module.load (VM129 module.js:488)
        at tryModuleLoad (VM129 module.js:447)
        at Function.Module._load (VM129 module.js:439)
        at Module.require (VM129 module.js:498)
        at require (VM130 module.js:20)
        at Object.<anonymous> (E:\GitHub\Portfolio-Manager\node_modules\grpc\src\client_interceptors.js:145)

当前依赖项:

  "dependencies": {
    "axios": "^0.16.1",
    "firebase": "^5.3.1",
    "flexboxgrid": "^6.3.1",
    "grpc": "^1.12",
    "nedb": "^1.8.0",
    "numeral": "^2.0.6",
    "vue": "^2.3.3",
    "vue-electron": "^1.0.6",
    "vue-router": "^3.0.1",
    "vue2-scrollbar": "0.0.3"
  },

如有任何帮助,我们将不胜感激。

最佳答案

经过一些研究,我发现了一个命令,可以正确地重建所需的二进制文件。

npm rebuild --runtime=electron --target=1.8.4 --disturl=https://atom.io/download/electron

在这篇文章中,electron 1.8.* 应该适用于此。

关于node.js - 问题将 Firebase 添加到 Electron 项目,gRPC 依赖问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51717602/

相关文章:

ios - 显示您关注的用户的帖子 - swift 和 firebase

javascript - 即使该路径上有数据,Firebase 事务也会在路径上读取 null

node.js - 为什么按需node-sp-auth不显示浏览器窗口?

javascript - 尝试在 Protractor 中使用类时获取 "TypeError: Dropdown is not a function"

ios - Firestore 消息 : Sending message to Topic with Swift

javascript - 当从 Node js 应用程序发生插入时,插入触发器不起作用

javascript - 无法在 IPCRenderer 中传递对象/数组,无法克隆对象 EventEmitter.i.send.i.send

macos - 关闭 Electron 应用程序时如何本地显示“保存更改”对话框?

node.js - 在 AWS Beanstalk 上使用 node.js 监听 SSL

node.js - NGINX SSL 重定向过于频繁