得到Module not found: Can't resolve 'fs'
尝试从 GCP Storage 列出存储桶时出错。
import { Storage } from '@google-cloud/storage';
const googleCloud = new Storage({
keyFilename: '../../my-project-c1a44bf80be3.json',
projectId: 'my-project',
});
googleCloud.getBuckets().then((x: any) => console.log(x));
my-project-c1a44bf80be3.json
(从GCP下载)存在并且是项目级别
Error:
event - compiled successfully
event - build page: /
wait - compiling...
error - ./node_modules/@google-cloud/storage/build/src/file.js:24:0
Module not found: Can't resolve 'fs'
null
Could not find files for / in .next/build-manifest.json
event - compiled successfully
使用时出现同样的错误谷歌API https://www.npmjs.com/package/googleapis。
然而,代替./node_modules/@google-cloud/storage/build/src/file.js:24:0
它在google-auth-library
附带的模块googleapis
.
添加使用yarn
.
当您在客户端导入或引用 firebase-admin 时,通常会发生这种情况,请检查您的代码是否有可能调用的错误导入
import * as firebase from "firebase-admin";
代替
import firebase from "firebase";
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)