简体   繁体   English

每次我使用 expo 运行我的 React 本机应用程序时都会遇到这个问题,我需要支持

[英]Am facing this problem each time i run my react native app using expo please i need support

While trying to resolve module idb-keyval from file C:\Users\ADMIN\Desktop\Fintech\node_modules\parse\lib\react-native\IndexedDBStorageController.js , the package C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\package.json was successfully found.在尝试从文件C:\Users\ADMIN\Desktop\Fintech\node_modules\parse\lib\react-native\IndexedDBStorageController.js解析模块 idb idb-keyval时, package C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\package.json成功找到C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\package.json However, this package itself specifies a main module field that could not be resolved ( C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs . Indeed, none of these files exist:然而,这个 package 本身指定了一个无法解析的main模块字段( C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs 。实际上,这些文件都不存在:

  • C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json) C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|. tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
  • C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json) C:\Users\ADMIN\Desktop\Fintech\node_modules\idb-keyval\dist\compat.cjs\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx |.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)

You need to modify the metro.config.js file.您需要修改metro.config.js文件。

Add the cjs extension in the resolver part在解析器部分添加cjs扩展

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
  resolver: {
    sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs'],
  },
};

I think you have same issue as here我想你和这里有同样的问题

you will most likely find that somewhere along the line your auto import imported useEffect, useState etc from there instead of from "react" itself.您很可能会发现您的自动导入从那里导入了 useEffect、useState 等,而不是从“react”本身导入。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在使用 react native with expo 构建一个应用程序,其中我需要对 android 上的图片库的许可 - I m building an app using the react native with expo in which i need the permission for the image gallery on android 一旦我在 android 上运行我的 react-native 应用程序就面临问题 - Facing issue once i run my react-native app on android 无法在设备/模拟器中运行我的React-Native应用程序,并且我遇到以下错误 - Could not run my React-Native app in device/emulator and i'm facing below error 我正在尝试构建 react native 应用程序,但出现此错误:react native version mismatch expo - I am trying to build react native app and I get this error: react native version mismatch expo Expo SDK 需要 Expo 才能运行。 我是 react-native 的初学者? - The Expo SDK requires Expo to run. i am beginner in react-native? 我在运行 react-native run-android 时遇到了这个问题 - I am facing this issue when I am running react-native run-android 我无法在移动(android)REACT NATIVE 中运行应用程序 - I am not able to run app in mobile (android) REACT NATIVE 所以我目前正在尝试将应用程序上传到 PlayStore,但我需要将我的反应原生项目从 api lvl 28 升级到 29 - So I am currently trying to upload an app to PlayStore but I need to upgrade my react native project from api lvl 28 to 29 与 expo 反应原生:在 gennymotion 问题上运行项目 - react native with expo:Run project on gennymotion problem 如何使用旧的 Expo 密钥签署我的新 React Native App [Android]? - How do I sign my new React Native App [Android] with my old Expo key?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM