Metro-bundler error: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Trying to run the app through xcode (IOS) and metrobundler, I am getting this error
error: bundling failed: Error: Unable to resolve module @babel/runtime/helpers/interopRequireDefaultfrom/index.js: Module @babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
- Clear watchman watches:
watchman watch-del-all. - Delete the
node_modulesfolder:rm -rf node_modules && npm install. - Reset Metro Bundler cache:
rm -rf /tmp/metro-bundler-cache-*ornpm start -- --reset-cache. - Remove haste cache:
rm -rf /tmp/haste-map-react-native-packager-*.
at ModuleResolver.resolveDependency (/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:183:15)
at ResolutionRequest.resolveDependency (/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/node_modules/@react-native-community/cli/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
at Object.resolve (/node_modules/@react-native-community/cli/node_modules/metro/src/lib/transformHelpers.js:261:42)
at dependencies.map.result (/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31)
at Array.map ()
at resolveDependencies (/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)
at /node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33
at Generator.next ()
at asyncGeneratorStep (/node_modules/@react-native-community/cli/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
BUNDLE [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.`
Tried the steps:
Clear watchman watches: watchman watch-del-all.
Delete the node_modules folder: rm -rf node_modules && npm install.
Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.
npm add @babel/runtime npm install
Uninstalling watchman
npm add @babel/runtime --save-dev
Added "ignore_dirs": ["node_modules"] in .watchmanconfig
react-native start --reset-cache
Nothing seems to work. And I am stuck with this error. This is my system info:
react-native-cli: 2.0.1, react-native: 0.59.9
watchman --version 4.9.0
"@babel/runtime": "7.0.0", "@babel/cli": "7.5.0", "@babel/core": "7.5.4"
Checked file: @babel/runtime/helpers/interopRequireDefault which is present at the given location
Thanks for going through this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the iOS bundle failure from index.js and inspect the Metro resolution paths shown in the error, especially the lookup for @babel/runtime/helpers/interopRequireDefault. Review the listed cache, Watchman, and dependency-reset commands, then verify completion when Metro bundles the app without the missing-module error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100