react-native-macos: bundling failed: Error: Unable to resolve module `../Components/AccessibilityInfo/AccessibilityInfo` from `node_modules/react-native/Libraries/react-native/react-native-implementation.js`:

While running the app in bundler it fails with the following message in the terminal

warning: the transform cache was reset. Loading dependency graph, done.

To reload the app press “r” To open developer menu press “d”

error: bundling failed: Error: Unable to resolve module ../Components/AccessibilityInfo/AccessibilityInfo from node_modules/react-native/Libraries/react-native/react-native-implementation.js:

None of these files exist:

  • node_modules/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo(.native|.macos.js|.native.js|.js|.macos.json|.native.json|.json|.macos.ts|.native.ts|.ts|.macos.tsx|.native.tsx|.tsx)
  • node_modules/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo/index(.native|.macos.js|.native.js|.js|.macos.json|.native.json|.json|.macos.ts|.native.ts|.ts|.macos.tsx|.native.tsx|.tsx) at ModuleResolver.resolveDependency (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15) at ResolutionRequest.resolveDependency (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18) at DependencyGraph.resolveDependency (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/node-haste/DependencyGraph.js:282:16) at Object.resolve (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/lib/transformHelpers.js:267:42) at dependencies.map.result (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31) at Array.map (<anonymous>) at resolveDependencies (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18) at /Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33 at Generator.next (<anonymous>) at asyncGeneratorStep (/Users/dev/Desktop/Sangeeth/mytakeaway2.0/Myt-Mac/MYT_MacOS/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24) BUNDLE [macos, dev] ./index.js ░░░░░░░░░░░░░░░░ 3.1% (9/77), failed.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20

Most upvoted comments

Was anyone with Mac M1 were able to fix this? Im building pure project without troubles, but this starting to happen for existing project with real dependencies and rn v 0.69.5 . Configuring metro seems not doing anything; and when trying to comment-out imports from react-native’s index.js, it causes error, when it trying to import something from Platform.

Can you try this again with react-native-macos 0.62.11.

Close running Metro and run react-native run-macos again. It’ll solve the problem. No need to change or rename any file

I fixed this by removing .ios.js extension with .js in files inside react-native/libraries/components

For example, I changed AccessibilityInfo.ios.js --> AccessibilityInfo.js Likewise, there are so many files which need these changes like Checkbox, DatePicker, Alert, Settings, etc

I was mistaken in my above comment about this happening automatically currently. There was a change that I thought we’d made in react-native-macos that never happened. If I work out what #587 needs, then it would work without a custom metro config. Otherwise, you can run the snipped in my comment above to configure metro correctly for macos.