问题描述
我正在使用googleapi编写无服务器应用程序
// in my ./api/google.js
import { google } from "googleapis"
...
...
当我尝试构建项目(使用serverless deploy
)时,出现以下错误。
注意:在添加./api/google.js文件之前,我的项目必须正确构建
ERROR in ./node_modules/gcp-Metadata/build/src/index.js
Module parse Failed: Unexpected token (101:8)
You may need an appropriate loader to handle this file type.
| async function fastFailMetadataRequest(options) {
| const secondaryOptions = {
| ...options,| url: options.url.replace(getBaseUrl(),getBaseUrl(exports.SECONDARY_HOST_ADDRESS)),| };
@ ./node_modules/google-auth-library/build/src/auth/envDetect.js 17:20-43
@ ./node_modules/google-auth-library/build/src/index.js
@ ./node_modules/googleapis/build/src/index.js
@ ./apis/google.js
ERROR in ./node_modules/google-auth-library/build/src/auth/jwtaccess.js
Module parse Failed: Unexpected token (75:16)
You may need an appropriate loader to handle this file type.
| }
| const header = this.keyId
| ? { ...DEFAULT_HEADER,kid: this.keyId }
| : DEFAULT_HEADER;
| const payload = Object.assign(defaultClaims,additionalClaims);
@ ./node_modules/google-auth-library/build/src/index.js 27:18-45
@ ./node_modules/googleapis/build/src/index.js
@ ./apis/google.js
Error --------------------------------------------------
Error: Webpack compilation error,see above
...
...
此错误的根本原因是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)