react-native-mmkv icon indicating copy to clipboard operation
react-native-mmkv copied to clipboard

Unable to resolve module ./createMMKV.mock

Open sanowar-drivex opened this issue 3 months ago • 1 comments

im getting error while creatingstorage import { MMKV } from 'react-native-mmkv'; export const storage = new MMKV()

None of these files exist:

  • node_modules/react-native-mmkv/lib/module/createMMKV.mock(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  • node_modules/react-native-mmkv/lib/module/createMMKV.mock/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) 1 | import { createMMKV } from './createMMKV';

2 | import { createMockMMKV } from './createMMKV.mock'; | ^ 3 | import { isJest } from './PlatformChecker'; 4 | const onValueChangedListeners = new Map(); 5 | at ModuleResolver.resolveDependency (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:152:15) at DependencyGraph.resolveDependency (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/node-haste/DependencyGraph.js:264:43) at Object.resolve (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/lib/transformHelpers.js:170:21) at resolveDependencies (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/DeltaBundler/graphOperations.js:466:33) at processModule (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/DeltaBundler/graphOperations.js:232:31) at async addDependency (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18) at async Promise.all (index 0) at async processModule (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/DeltaBundler/graphOperations.js:279:3) at async addDependency (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/DeltaBundler/graphOperations.js:361:18) at async Promise.all (index 0) ERROR [Error: undefined Unable to resolve module ./createMMKV.mock from /home/lap099/Desktop/drivex-mobile-frontend/node_modules/react-native-mmkv/lib/module/MMKV.js:

None of these files exist:

  • node_modules/react-native-mmkv/lib/module/createMMKV.mock(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  • node_modules/react-native-mmkv/lib/module/createMMKV.mock/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx) 1 | import { createMMKV } from './createMMKV';

2 | import { createMockMMKV } from './createMMKV.mock'; | ^ 3 | import { isJest } from './PlatformChecker'; 4 | const onValueChangedListeners = new Map(); 5 |] this is my package.json file { "name": "nameOfProject", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-async-storage/async-storage": "^1.19.3", "@react-native-community/datetimepicker": "^7.1.0", "@react-native-community/netinfo": "^9.3.10", "@react-native-firebase/app": "^18.6.1", "@react-native-firebase/messaging": "^18.6.1", "@react-native-picker/picker": "^2.4.10", "@react-navigation/material-top-tabs": "^6.6.8", "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.12", "@rneui/base": "^4.0.0-rc.7", "@rneui/themed": "^4.0.0-rc.8", "axios": "^1.4.0", "native-base": "^3.4.28", "react": "18.1.0", "react-hook-form": "^7.44.3", "react-native": "0.70.9", "react-native-audio-recorder-player": "^3.5.3", "react-native-compressor": "^1.8.24", "react-native-datepicker": "^1.7.2", "react-native-device-info": "^10.6.0", "react-native-dotenv": "^3.4.9", "react-native-elements": "^3.4.3", "react-native-fs": "^2.20.0", "react-native-geolocation-service": "^5.3.1", "react-native-keychain": "^8.1.1", "react-native-linear-gradient": "^2.6.2", "react-native-mmkv": "^2.12.2", "react-native-modal-datetime-picker": "^15.0.1", "react-native-pager-view": "^6.2.3", "react-native-permissions": "^3.8.0", "react-native-safe-area-context": "^3.3.2", "react-native-screens": "^3.20.0", "react-native-splash-screen": "^3.3.0", "react-native-svg": "^12.1.1", "react-native-swiper-flatlist": "^3.2.3", "react-native-tab-view": "^3.5.2", "react-native-vector-icons": "^9.2.0", "react-native-video": "^5.2.1", "react-native-vision-camera": "^2.16.8" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "0.72.3", "react-test-renderer": "18.1.0" }, "jest": { "preset": "react-native" } }

sanowar-drivex avatar Mar 27 '24 07:03 sanowar-drivex

i got another error also [Error: InternalError Metro has encountered an error: While trying to resolve module react-native-mmkv from file /home/lap099/Desktop/drivex-mobile-frontend/src/App.jsx, the package /home/lap099/Desktop/drivex-mobile-frontend/node_modules/react-native-mmkv/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/home/lap099/Desktop/drivex-mobile-frontend/node_modules/react-native-mmkv/lib/module/index. Indeed, none of these files exist:

  • /home/lap099/Desktop/drivex-mobile-frontend/node_modules/react-native-mmkv/lib/module/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  • /home/lap099/Desktop/drivex-mobile-frontend/node_modules/react-native-mmkv/lib/module/index/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx): /home/lap099/Desktop/drivex-mobile-frontend/node_modules/metro/src/node-haste/DependencyGraph.js (277:17)

275 | 276 | if (error instanceof InvalidPackageError) {

277 | throw new PackageResolutionError({ | ^ 278 | packageError: error, 279 | originModulePath: from, 280 | targetModuleName: to,]

sanowar-drivex avatar Mar 27 '24 08:03 sanowar-drivex