如何将谷歌数据存储包添加到电子应用程序

问题描述 投票:0回答:1

我的第一个电子应用程序:它是一个管理员应用程序,只能在我的机器上运行

我想在其中添加@ google-cloud / datastore模块,但导入包后电子将无法启动。

我使用'yarn add'添加包,然后按照此处的说明使用电子重建重建电子:https://electronjs.org/docs/tutorial/using-native-node-modules

第一个错误是:

Failed to compile
./node_modules/@grpc/grpc-js/build/src/channel.js
Module not found: Can't resolve 'http2' in '<...>\node_modules\@grpc\grpc-js\build\src'

所以我尝试手动添加纱线http2,电子重建和'纱线启动',之后我收到一些警告:

./node_modules/http2/lib/protocol/index.js                                                                                                              
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted                                            
./node_modules/grpc/src/grpc_extension.js                                                                                                               
Critical dependency: the request of a dependency is an expression                                                                                      
./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js                                                                                       
Critical dependency: the request of a dependency is an expression                                                                                      
./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 

该应用程序然后启动,但显示一长串错误。

Error: Cannot find module './../process/browser.js'
... intermediate errors, below is the module trying to import
Module../node_modules/merge2/index.mjs

我不确定我/我做错了什么,或者谷歌数据存储是否与电子不兼容?

node.js google-cloud-datastore electron yarnpkg
1个回答
0
投票

使用最新的Electron和谷歌软件包(没有其他变化)似乎解决了这个问题

© www.soinside.com 2019 - 2024. All rights reserved.