[英]Expo Firebase Authentication "While trying to resolve module `idb` from file"
This is my first app.这是我的第一个应用程序。 I'm trying to use Firebase for Email/Password authentication.
我正在尝试使用 Firebase 进行电子邮件/密码身份验证。 I followed the basic tutorial https://firebase.google.com/docs/auth/web/password-auth#web-version-9 , and I keep getting this error:
我遵循了基本教程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`.
I've added this to metro.config.js:我已将其添加到 metro.config.js 中:
resolver: {
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs'],
},
and the issue is still there.问题仍然存在。
To resolve this issue, create a metro.config.js file in the project root.要解决此问题,请在项目根目录中创建一个metro.config.js文件。 In the file add the file extension
cjs
.在文件中添加文件扩展名
cjs
。 details 细节
const { getDefaultConfig } = require("@expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push("cjs");
module.exports = defaultConfig;
I get the same error when adding firebase to a clean project.将 firebase 添加到干净的项目时出现相同的错误。 I think there's something funny with the latest firebase version so I've downgraded to 9.6.11 to temporarily fix the problem.
我认为最新的 firebase 版本有些有趣,所以我已降级到 9.6.11 以暂时解决问题。 Hopefully they sort it out soon...
希望他们尽快解决...
npm uninstall firebase
npm install firebase@9.6.11
I have Done the modification, but got the same error as below mentioned我已经完成了修改,但得到了与下面提到的相同的错误
Unable to resolve "idb" from "node_modules\@firebase\app\dist\esm\index.esm2017.js"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.