Repository navigation
Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map #21310
Description
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
Memory: 408.65 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 25.0.3, 26.0.2, 26.0.3, 27.0.1, 27.0.2
API Levels: 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.1 => 0.57.1
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Description
When starting a new project with react-native init then run iOS, I'm getting the error :
Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map
Reproducible Demo
react-native init myapp
// FIX CFBundleIdentifier issue with react-native upgrade
react-native run-ios
Get the error.
FIX
The issue can be fix by doing:
npm add @babel/runtime
npm install
But we shouldn't have to do all this stuff !

Activity
sunnylqm commentedon Sep 25, 2018
Should wait for this to be merged #21283
Aximem commentedon Sep 25, 2018
rodrigoelp commentedon Sep 25, 2018
I've just run into this issue... ever since xcode 10 came out, the number of issues have been out of this world
Cnordbo commentedon Sep 25, 2018
Had the same issue on W10 machine.
Its a brand new setup.
Suggested fix works.
jlcool commentedon Sep 25, 2018
silentsiri commentedon Sep 25, 2018
g4laura commentedon Sep 25, 2018
for now since a lot of new changes are coming out, this fix worked for me:
with npm:
npm install --save @babel/runtime
or with yarn:
yarn add @babel/runtime
(edited: if you're planning on waiting for the release that fixes this before releasing a new production build (like me) you can keep babel/runtime in devDependencies, but if you want to build a release build with this version of react-native, you need to put @babel/runtime in dependencies as the original poster said)
if on ios you get _this._registerEvents is not a function, after a successful build
do
npm run start --reset-cache
or
react-native start --reset-cache
edit:
should add @babel/core, under resolutions, in package.json
you may also need "babel-core": "7.0.0-bridge.0" in resolutions
but this is more for react-native projects being upgraded..
boovius commentedon Sep 25, 2018
wow @g4laura you da man (woman) ! 👍
sungkhum commentedon Sep 25, 2018
You all just fixed the issues I've been having for two days (new to react native). Hopefully these bugs will be fixed, but in the mean time
worked for me. Thanks @Aximem
masashi49 commentedon Sep 26, 2018
私の環境です
私もこのエラーが出ていましたが、
これで動きました!
ありがとう!!
zenz commentedon Sep 26, 2018
just add @babel/runtime to devDependencies is ok.
yarn add @babel/runtime --devsunnylqm commentedon Sep 26, 2018
Fixed in 1323acd but not landed in any version yet, will try to urge them to land in 0.57.2
vyvee commentedon Sep 26, 2018
Thanks @g4laura ! I have been trying to fix this issue for 2 days & your suggestion (especially the inclusion of @babel/runtime) simply works!!
I have tested it for Android, but not for iOS yet.
punter82 commentedon Sep 26, 2018
Thanks @Aximem . Your suggestion worked !!!
ThPch commentedon Sep 26, 2018
Thanks for the short fix guys. I'm new to react-native too and it's been 3 days that from a scratch, clean windows install I'm trying to launch a very simple program. Finaly it's working. Thank you again
69 remaining items
grantgeorge commentedon Feb 14, 2020
Fun morning. I had to reset a bunch of dependencies and caches to get things to work. I ended up having to do a combination of things mentioned in this issue and this post.
Ensure that @babel/core and @babel/runtime had matching, exact versions in dev dependencies in
package.json.Nuke & pave:
robertoporlan commentedon Mar 31, 2020
Thank You so mutch! You save me! haha
stale commentedon Jul 3, 2020
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
stale commentedon Jul 11, 2020
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
hugoh59 commentedon Sep 14, 2020
I'm still getting this issue with react-native 0.63.2 and none of these solved it.
OlegPanfyorov commentedon Sep 16, 2020
@hugoh59 Same for me, I'm really shocked. I tried everything. RN is a piece of shit
artadmire commentedon Dec 25, 2020
I'm still getting this issue with react-native 0.63.2 and none of these solved it. Please helper!
lchnnl commentedon Feb 14, 2021
I had the same issue. This is what i did to resolve.
Update homebrew (brew update)
Upgrade watchman (brew upgrade watchman)
Made the changes as suggested by (here)[https://github.com//issues/27712#issuecomment-572889578]
Then ran my npx react-native bundle ....
After successful run
I changed the code back to the original
kovkev commentedon May 26, 2021
I am getting this issue with
I am not sure how to troubleshoot it. I've tried the solutions presented here.
matthew-dean commentedon Oct 14, 2022
Getting this issue with importing directly a TypeScript module package. Wiping and re-installing with
pnpm installhas not worked.kockar96 commentedon Jan 6, 2023
Someone may find this helpful. I had the same problem while using turborepo and Expo.
Resolved it by adding 'node-linker=hoisted' to .npmrc.
chiraag918 commentedon Apr 10, 2023
I am facing a similar issue, but it is on reactjs. So I have a component library which I have published on github packages using Rollup as my bundler. The component library is also developed in reactjs. So when I install this library on a consumer application(reactjs web app), I'm getting the error as shown in the attached screenshot. Until a month and a half ago everything was working fine. After which I published a new version and ever since that I'm facing the same issue. The version previous to this new version that I published a month and a half ago is working fine but anything published after this version throws up the same error. I even reverted the code back to how it is on the version that is working, but no luck. Requesting help on this issue. Need to resolve this as early as possible.
support pnpm build error per this helpful comment when facing @babel-…