'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. 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:
- 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)
Solution 1:[1]
You need to modify the metro.config.js file.
Add the cjs extension in the resolver part
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs'],
},
};
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ali Abbas |
| Solution 2 | fixedDrill |
