react-native: [android / ios] bundling failed: "TransformError
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: react-native-cli: 2.0.0 react-native: n/a - not inside a React Native project directory (I was inside the folder, version is: 0.47.1)node -v
: v7.10.0npm -v
: 4.2.0yarn --version
: 0.17.10
Then, specify:
- Target Platform: Android, iOS
- Development Operating System: macOS Sierra 10.12.6
- Build tools: Using Xcode 8.3.3 and Android Studio 2.3
Steps to Reproduce
react-native init rn_reproduce_transform_error
cd rn_reproduce_transform_error
react-native run-ios
orreact-native run-android
Expected Behavior
Should show the default “Welcome to React Native!” screen.
Actual Behavior
Same error occurs when I tried to update RN version to 0.48.0-rc.1
Reproducible Demo
https://github.com/esganzerla/rn_reproduce_transform_error
Notes
- This happens both on android and iOS.
- I saw some people having the same problem on issue #15496.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 42
- Comments: 35 (9 by maintainers)
I’ve just found a workaround:
yarn remove babel-preset-react-native
yarn add babel-preset-react-native@2.1.0
The hole is probably deeper, but that is works for me.
It is a bug an the work around that worked for me was to edit dependency of babel in package.json to “babel-preset-react-native”: “2.1.0”. After which I deleted node_modules and re-installed the npm (npm install). Then it worked like a charm.
If you Still Getting Problem in babel-preset-react-native then try Following Process
package.json
“dependencies”: { “react”: “16.0.0-alpha.12”, “react-native”: “0.47.1”, “babel-preset-react-native”: “2.1.0” --------->Here },
Delete ‘Node_modules’ folder from react native project manually and run followinf Commands in react native project $ npm install $ npm start – --reset-cache $ react-native run-android
It’s because trailing commas in function parameter lists are not supported.
https://github.com/facebook/react-native/blob/6ad7e8281b37ee2ce6425363c0b17420d056807a/babel-preset/configs/main.js#L40
Restarting didn’t help here too.
@tmartres Restarting don’t work for me
@Ibrokola thanks worked for me.
Check
index.ios.js
, see if there is a trailling comma. If so, delete it. It works for me.for my case , it need execute
npm install babel-preset-react-native@2.1.0 --save-dev
, it works for me .Thx a lot dude @esganzerla , your workaround fixed my problem
Thank you for reporting and for the workaround @esganzerla.
It seems an issue with
babel-preset-react-native@3.0.0
that was released earlier.@jeanlauliac How should we fix this issue? Add a specific major version in
react-native-cli
? Or something has been planned? https://github.com/facebook/react-native/blob/a54d449e947afc609a404a699494902823fbbf5e/local-cli/init/init.js#L91cc @ericnakagawa who’s on call.
I’m running into this in
babel-preset-react-native: ^5.0.0
. Anyone else having this problem? I’ve tried several different versions ofbabel-preset-react-native
and haven’t had any luck. Been debugging it for 7-8 hours now. Clearing xcode caches, npm caches, deleting and reinstalling pods, node modules, restarting process on :8081, where else could this be coming from? …@cheng-kang your answer worked. I did all the steps necessary, yarn delete yarn add, npm install, uninstall, babel preset version upgrades but nothing worked but your solution.
@ShubhamBabhulkar, I think there’s a bug 🐜 in 3.0 that needs to be fixed…
On Fri, Aug 18, 2017 at 1:34 AM ShubhamBabhulkar notifications@github.com wrote:
Did you delete node_modules if not delete node_modules and run npm install. I am certain it will work.
On Thu, Aug 17, 2017 at 4:02 AM, ShubhamBabhulkar notifications@github.com wrote:
uninstalling and installing babel-preset-react-native works for me thanks a lot @esganzerla
I’ve tried to create a new RN app by RNCA (Expo) and then eject it. Works perfectly fine, although it runs on React Native 0.46.1, so I’m guessing this is an issue with 0.47.