-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bundling failed: Error: Unable to resolve module ../Components/AccessibilityInfo/AccessibilityInfo
from node_modules/react-native/Libraries/react-native/react-native-implementation.js
:
#564
Comments
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 |
The above error indicates that your metro config is not correct. It should never be loaded files from react-native when bundling for macos -- it should get all the files from react-native-macos. Are you on 0.62? And using at least version 4.9 of @react-native-community/cli? |
For 0.61 you'd need a seperate metro config for macos, like react-native-netinfo does: |
what is causing this issue and how do i fix this ? |
Close running Metro and run |
When bundling for macos, metro should be told to redirect any react-native import to react-native-macos. In 0.61 you have to do this manually by changing your config when bundling for macos. (The config wont work for other platforms) resolver: {
extraNodeModules: {
'react-native': path.resolve(__dirname, 'node_modules/react-native-macos')
},
},
serializer: {
getModulesRunBeforeMainModule: () => [
require.resolve(
path.resolve(__dirname, 'node_modules/react-native-macos/Libraries/Core/InitializeCore')),
]
},
transformer: {
assetRegistryPath: path.resolve(__dirname, 'node_modules/react-native-macos/Libraries/Image/AssetRegistry'),
}, For 0.62, so long as you are using @react-native-community/cli@4.9 or greater, then the cli should automatically set this up for you. |
I had to remove the global |
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. |
@acoates-ms Also, it seems that if you run |
Can you try this again with react-native-macos 0.62.11. |
It works but not with the command from the react-native-docs (npx react-native run-macos) Instead it works when we start the metro server and app separately as -
|
@acoates-ms @HeyImChris FYI I ran into this again today, where I had run "yarn ios" from fluent-ui-react-native tester app, and then was trying to run "yarn macos" to have both testers up, but ran into this error. I don't know where documentation for react-native-macos is going, but if this issue can't be fixed, then we should mention it as a known issue in documentation (i.e. if you're running both ios and mac, make sure to run macos first). Let me know if you have any questions. |
I ran into this again today, was able to get past the error with the code above, but am now getting a "No bundle URL present" error. Any ideas? |
I'm getting the same error from a clean install of everything:
|
I re-installed my entire environment again, and followed setting up react native and then setting up react native macos, and this is the error I get. |
Same here. I'm using an M1 MacBook air and same issue. I tried everything mentioned above. |
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Was anyone with Mac M1 were able to fix this? |
Any update? |
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
fromnode_modules/react-native/Libraries/react-native/react-native-implementation.js
:None of these files exist:
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 ()
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 ()
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.
The text was updated successfully, but these errors were encountered: