简体   繁体   English

Expo Firebase 身份验证“尝试从文件中解析模块 `idb` 时”

[英]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;

ScreenShot截屏

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.

相关问题 firebase-js-sdk v9 不适用于本机反应? 错误:尝试解析模块“idb”时 - firebase-js-sdk v9 doesn't work with react native? Error: While trying to resolve module `idb` React-native 捆绑失败。 错误消息:“在尝试解析模块 'idb' 时......实际上这些文件都不存在”: - React-native bundling failure. ERROR MESSAGE: "While trying to resolve module 'idb'..... Indeed none of these files exist": 无法从“node_modules\@firebase\app\dist\esm\index.esm2017.js”解析“idb” - Unable to resolve "idb" from "node_modules\@firebase\app\dist\esm\index.esm2017.js" 如何解决此 firebase 导入错误? 找不到模块:错误:Package 路径。 不从 package 导出 - How do I resolve this firebase import error? Module not found: Error: Package path . is not exported from package 未找到模块:错误:无法解析“./Firebase” - Module not found: Error: Can't resolve './Firebase' 找不到模块:无法解析“firebase” - Module not found: Can't resolve 'firebase' in 将 firebase 身份验证与来自 firebase 的实时数据库连接 - connect firebase authentication with realtime database from firebase Heroku 未找到模块:错误:无法解析“-/firebase-config” - Heroku Module not found: Error: Can't resolve '-/firebase-config' Expo react-native app with firebase phone authentication works on web, error on ios simulator and crashes with no warning on Android - Expo react-native app with firebase phone authentication works on web, error on ios simulator and crashes with no warning on Android 无法解析模块“firebase-admin/app”的路径(ESLint) - Unable to resolve path to module 'firebase-admin/app' (ESLint)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM