react-native init MyApp
cd MyApp
react-native run-android
ios也一样的问题
Workaround: npm install --save-dev @babel/plugin-external-helpers
Fixed
npm install --save-dev @babel/plugin-external-helpers
Seems related to this https://github.com/facebook/metro/pull/198
npm install --save-dev @babel/plugin-external-helpers does not work for me.
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 51.67 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.10.0 - /usr/local/bin/node
Yarn: 1.9.4 - /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
IDEs:
Android Studio: 1.1.0 AI-135.1740770
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.0 => 0.57.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
@sopranolinist After installing it, what's the error shown?
@HsuWai same error as before adding the babel plugin package: Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(/Users/myMac/Desktop/Coding/react-native-redux-test/testApp/index.js: Cannot find module '@babel/plugin-external-helpers' (null))
Ok.. If so, I think you should take a look and try like what @sunnylqm said.
Remember to restart packager after installing any package. My link above does not provide any direct fix, just for reference.
@sunnylqm So, is there a way to solve this problem?
@hqwlkj npm install --save-dev @babel/plugin-external-helpers and Remember to restart packager after installing any package.
In addition to above suggestion, I rebooted and deleted old build folder
and it worked - thanks
On Thu, Sep 20, 2018 at 12:52 AM Sunny Luo notifications@github.com wrote:
@hqwlkj https://github.com/hqwlkj npm install --save-dev
@babel/plugin-external-helpers and Remember to restart packager after
installing any package.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/21214#issuecomment-423077789,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Aor6QHGOJG_Ul2Efq9FKZafFF_sfEO6uks5uc0k_gaJpZM4WxZ8J
.
Ignorance is man's greatest immaturity.
--
@HsuWai what the @babel/plugin-external-helpers version are you install,i install 7.0.0,then show another error
after install shown :: Cannot find module 'metro-react-native-babel-preset/src/configs/hmr'
could you printf your package.json
@git-Asir Are you upgrading to 0.57? Make sure you have followed the steps here https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#updating-to-this-version
安装后显示::无法找到模块'metro-react-native-babel-preset / src / configs / hmr'
你可以打印你的package.json
The same to you
Installing @babel/plugin-external-helpers fixed it for me!
This is happening to me too and installing @babel/plugin-external-helpers doesn't help. I'm on a Mac. This happened with my main project, and then I created a new test project from scratch and it happened with that as well.
@git-Asir my @babel/plugin-external-helpers version is also 7.0.0.
This is my package.json
We are working on a fix with Metro team. Here's explanation from the issue I've opened today: https://github.com/facebook/react-native/issues/21219#issue-362115854
For me it was coming because of mismatch in the versions of the dependencies.
Worked when I matched versions in package.json and run npm install in the project directory.
"dependencies": {
"@babel/runtime": "7.0.0",
"react": "16.6.3",
"react-native": "^0.57.8"
},
"devDependencies": {
"babel-jest": "23.6.0",
"metro-react-native-babel-preset": "^0.45.0",
"jest": "23.6.0",
"react-test-renderer": "16.5",
"schedule": "^0.4.0"
},
"jest": {
"preset": "react-native"
}
Most helpful comment
Workaround: npm install --save-dev @babel/plugin-external-helpers