Kri*_*shP 15 firebase firebase-authentication expo
这是我的第一个应用程序。我正在尝试使用 Firebase 进行电子邮件/密码身份验证。我按照基本教程https://firebase.google.com/docs/auth/web/password-auth#web-version-9进行操作,但不断收到此错误:
While trying to resolve module `idb` from file '.../node_modules/@firebase/app/dist/esm/index.esm2017.js', the package `/Users/##/##/##/node_modules/idb/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/##/##/##/node_modules/idb/build/index.cjs`.
Run Code Online (Sandbox Code Playgroud)
我已将其添加到metro.config.js:
resolver: {
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs'],
},
Run Code Online (Sandbox Code Playgroud)
问题仍然存在。
Soh*_*ran 29
要解决此问题,请在项目根目录中创建一个Metro.config.js文件。在文件中添加文件扩展名cjs. 细节
const { getDefaultConfig } = require("@expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push("cjs");
module.exports = defaultConfig;
Run Code Online (Sandbox Code Playgroud)
小智 6
将 firebase 添加到干净的项目时,我遇到了同样的错误。我认为最新的 firebase 版本有些有趣,所以我降级到 9.6.11 以暂时解决该问题。希望他们尽快解决...
npm uninstall firebase
npm install firebase@9.6.11
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6551 次 |
| 最近记录: |