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
React Native: Unexpected token ':'. Expected a ')' or a ',' after a parameter declaration. #14139
Comments
Hey @rishabh876! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
I have the same problem. When I downgraded @babel/traverse to 7.16.7 my problem was solved. |
Hi @rishabh876! This issue is missing some important information we'll need to be able to reproduce this issue. Please understand that we receive a high volume of issues, and there are only a limited number of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided, the more likely it is that we'll be able to help. Please make sure you have the following information documented in this ticket:
Please provide either a link to the problem via the |
This might be caused by #14105, but unfortunately without a reproduction example it's impossible to know if the bug was actually introduced by that PR. It's the PR that most likely could have changed |
I have some problem React Native 0.61.5 |
I have the same problem. This is caused by #14105. Because of https://github.com/facebook/metro/blob/v0.58.0/packages/metro-react-native-babel-preset/src/transforms/transform-symbol-member.js#L52 will transform Please update If it doesn't take effect, please try And other two solutions: (only use one of)
from: module.exports = {
presets: ['module:metro-react-native-babel-preset'],
}; to: module.exports = {
presets: [['module:metro-react-native-babel-preset', {
unstable_disableES6Transforms: true
}]],
}; finally run |
@kerm1it it work for my project . thank you🍺 |
Oh thanks @kerm1it for investigating! We have some e2e tests to verify that we don't break React Native support, but we are only testing recent versions and Since #14105 is a fix for an actual bug, and the I will pin this issue for now, so that if anyone has the same problem they will see your suggested solution (i.e. update |
Hi, I have same error tried to update metro-react-native-babel-preset to 0.59.0 but not working for me Please help |
If it doesn't take effect, please try 'yarn start --reset-cache' to restart app. |
hi, I continues the same error, I try update this libraries, but not resolved my problem "@babel/core": "7.16.5", I'm try this steps: rm -rf node_modules |
me too! |
tried to reset cache but still facing same error |
can you print your babel.config.js and run npm ls metro-react-native-babel-preset? |
@Rekha16 @leandrovidal56 @qianqiang2017 Please read #14139 (comment) again to try other solutions. |
Thank You Very much I will try this solution |
If the solution doesn't work, we will need a repository that we can use to reproduce the bug. |
thank you @kerm1it, but I don't have success yet |
I guess it is caused by cache (ensure you restart app with |
|
Thanks guy, it work |
Update |
Thank you So much. it helped me out. my error is gone. I updated: everything come back to life |
Previous version was causing a crash when the App was launched in both: iOS & Android More info here: babel/babel#14139 (comment) Related to YD-4110
Working for me. |
Thanks bro. This solved my error. |
react-native version = 0.63.2 |
Update metro-react-native-babel-preset from |
hey thank you so much, it works .... |
I just copy&pasted these files & |
yarn start --reset-cache this line save my life after days |
Any update on this? |
@SyedSaifAli can you share your babel config and where it is defined. For me it did not work if its defined inside package.json. |
@rishabh876 sure, here it is
This is the babel.config.js file stored at node_modules/react-native/template/babel.config.js |
npx react-native start --reset-cache this command fixed my issue thanks guys |
This worked for me, Thank you so much, follow these steps one by one. |
Really helpful. |
for those having this issue, simple adding "babel-preset-expo": "~8.3.0" alone to my project fixed this error. "@babel/core": "^7.8.6", is all i had. |
Saved me (Trying for the last 6 days) was tired... still can't believe this happened to me. :D |
this very helpfull... thanks a lot for ur comment |
EDIT by @nicolo-ribaudo: If you see this error in React Native, you probably need to update
metro-react-native-babel-preset
and runyarn start --reset-cache
ornpx react-native start --reset-cache
- #14139 (comment).💻
How are you using Babel?
babel-loader (webpack)
Input code
Configuration file name
package.json
Configuration
Current and expected behavior
Current behavior
App shows red box with the error:
SyntaxError: Unexpected token ':'. Expected a ')' or a ',' after a parameter declaration.
No Stack
Environment
System:
OS: macOS 11.4
Binaries:
Node: 12.16.1 - ~/Documents/GitHub/unacademy-native/node_modules/.bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.1.0 - ~/Documents/GitHub/unacademy-native/node_modules/.bin/npm
npmPackages:
@babel/core: ^7.5.5 => 7.16.7
@babel/plugin-proposal-class-properties: ^7.0.0 => 7.16.7
@babel/plugin-transform-runtime: ^7.0.0 => 7.16.8
@babel/polyfill: ^7.0.0 => 7.12.1
@babel/preset-env: ^7.0.0 => 7.16.8
@babel/preset-flow: ^7.0.0 => 7.16.7
@babel/preset-react: ^7.0.0 => 7.16.7
@babel/register: ^7.0.0 => 7.16.9
@babel/runtime: ^7.5.5 => 7.16.7
babel-eslint: ^10.0.2 => 10.1.0
babel-loader: ^8.0.0 => 8.2.3
babel-plugin-extension-resolver: https://github.com/GingerBear/babel-plugin-extension-resolver => 0.0.1
babel-plugin-import: 1.7.0 => 1.7.0
babel-plugin-react-native-web: 0.8.9 => 0.8.9
eslint: ^6.1.0 => 6.8.0
metro-react-native-babel-preset: ^0.56.0 => 0.56.4
react-native: 0.61.4 => 0.61.4
webpack: ^4.6.0 => 4.46.0
Possible solution
Forcing all babel dependecies found in package-lock to a version < 7.16.8
Additional context
This started happening since 7.16.8 was release.
The text was updated successfully, but these errors were encountered: