Node.js:无法加载gRPC二进制模块,因为当前系统未安装该模块

时间:2019-02-10 21:49:25

标签: node.js typescript

我正在使用带有Typescript的电子框架开发桌面应用程序。当我尝试使用npm start部署应用程序时,出现以下错误:

    Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v4.0-darwin-x64-unknown
Found: [node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/Users/ahmet/Documents/JumbleUp-Desktop/node_modules/grpc/src/node/extension_binary/electron-v4.0-darwin-x64-unknown/grpc_node.node'
    at Object.<anonymous> (node_modules/grpc/src/grpc_extension.js:53)
    at Object.<anonymous> (node_modules/grpc/src/grpc_extension.js:63)
    at Module._compile (internal/modules/cjs/loader.js:693)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:704)
    at Module.load (internal/modules/cjs/loader.js:602)
    at tryModuleLoad (internal/modules/cjs/loader.js:541)
    at Function.Module._load (internal/modules/cjs/loader.js:533)
    at Module.require (internal/modules/cjs/loader.js:640)
    at require (internal/modules/cjs/helpers.js:20)
    at Object.<anonymous> (node_modules/grpc/src/client_interceptors.js:144)

尝试了许多在Internet上编写的解决方案,但似乎都没有用,谢谢。

1 个答案:

答案 0 :(得分:0)

> npm install electron-rebuild
> ./node_modules/.bin/electron-rebuild

以后可能会尝试这个对我有用