And*_*ann 5 google-api node.js http2 vue.js
我想在使用 googleapis 包的 nodejs webapp 中开始使用 Google 身份验证。安装后我需要这个包的那一刻,我立即收到以下错误:
protocol sync?8d88:2 Uncaught Error: Cannot find module './framer'
at webpackEmptyContext (eval at ./node_modules/http2/lib/protocol sync recursive (app.js:1053), <anonymous>:2:10)
at Array.map (<anonymous>)
at eval (index.js?1fa7:46)
at Object../node_modules/http2/lib/protocol/index.js (chunk-vendors.js:7788)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at Object.eval (http.js?4679:136)
at eval (http.js:1264)
at Object../node_modules/http2/lib/http.js (chunk-vendors.js:7711)
at __webpack_require__ (app.js:854)
Run Code Online (Sandbox Code Playgroud)
我在这里查看了来源:
var modules = ['./framer', './compressor', './flow', './connection', './stream', './endpoint'];
modules.map(require).forEach(function(module) {
for (module.serializers 中的变量名) {
export.serializers[name] = module.serializers[name];
}
});
并确认这些文件存在:
我已经尝试重新安装软件包(http2 和 googleapis),但没有任何变化。为什么那些相对的 require 语句会失败?文件清晰可见。
我的 webapp 是一个使用 vue 的客户端-服务器应用程序。另请注意,这是我使用 node 的第一个小项目,因此如果您需要我提供有关此问题的任何其他信息,请告诉我。
在此先感谢您的帮助。
我在尝试制作时也遇到了这个问题googleapislib 在 React 应用程序中工作时也遇到了这个问题。原因是googleapis推荐用于服务器端 Web 应用程序。
对于 React/客户端 Web 应用程序,我按照本文档使其工作。
https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow#js-client-library
| 归档时间: |
|
| 查看次数: |
1028 次 |
| 最近记录: |