当我想使用下面的代码使用firebase管理SDK时
import * as admin from 'firebase-admin';
var serviceAccount = require("../services/serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://voter-60a9f-default-rtdb.europe-west1.firebasedatabase.app"
});我知道这个错误
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
- install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "util": false }这只是其中之一。我也有这样的想法:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }等等..。
我试着重新安装Node模块,但没有成功。我也不明白我该在哪里加上他们建议的后遗症。如果我要找到它,是否需要为所有节点模块添加这个?
谢谢!
发布于 2022-05-16 07:13:56
我也遇到了同样的错误,你可以做的就是去node_modules/react-scripts/config/webpack-config.js做这些改变
resolve: {
modules: ...,
extensions: ...,
alias: {...}, fallback: {
"fs": false,
"tls": false,
"net": false,
"path": false,
"zlib": false,
"http": false,
"https": false,
"stream": false,
"crypto": false,
"crypto-browserify": false,
"url": require.resolve("url"),
"os": false,
"os-browserify": false,
"querystring": false,
"buffer": false,
"constants": false,
"child_process": false
},
plugins: [...]
},https://stackoverflow.com/questions/68997033
复制相似问题