簡體   English   中英

如何將Google數據存儲包添加到電子應用程序

[英]How to add google datastore package to electron app

我的第一個電子應用程序:這是一個僅在我的機器上運行的管理應用程序

我想向其中添加@ 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

我不確定是否/我做錯了什么,或者Google數據存儲是否以某種方式與電子不兼容?

使用最新的Electron和google軟件包(並且沒有其他更改)似乎已經解決了此問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM