Skip to content
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

Unhandled JS Exception: Unexpected token Expected a ')' or a ' after a parameter declaration. #32875

Closed
trabk1992 opened this issue Jan 12, 2022 · 30 comments
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@trabk1992
Copy link

Description

after delete file yarn.lock and yarn install
then build app , that error occur
error

Version

0.60.6

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 11.6
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 218.86 MB / 20.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.3.0 - /usr/local/bin/node
Yarn: 1.22.17 - ~/Documents/RabilooWorkSpace/yakuodo_app_mobile/node_modules/.bin/yarn
npm: 7.15.1 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
IDEs:
Android Studio: 4.2 AI-202.7660.26.42.7351085
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.6 => 0.60.6

Steps to reproduce

step 1: delete file yarn.lock and Podfile.lock
step 2: run 'yarn install'
step 3: run 'cd ios and Pod install'
step 4: build app
after show splash screen , app show error

error

Snack, code example, screenshot, or link to a repository

No response

@Satur-nity
Copy link

Satur-nity commented Jan 12, 2022

Facing the same error in react-native 0.61.5.

can anyone help?

@soleilpqd
Copy link

I'm working on project with RN 0.61.5 too.
Monday, I finished my task and did git commit at end of the day.
Yesterday, I added a dependency into package.json and did npm install, then got this error.
I tried git checkout to restore everything back to monday, delete lock file, node_modules, ~/npm. Nothing could help resolve the error.
I got same error on other (unmodified) projects using RN 0.61.5.
Lost 2 days and my work is still same as monday :(

@fabio-jreis
Copy link

Same error here 😩

react-native-cli: 2.0.1
react-native: 0.61.5

@LavanyaMacha2412
Copy link

Facing the same issue on RN 0.61.5

@joshua-davis-rose
Copy link

Same issue here with RN 0.63.4. Was working fine yesterday.

@JoseLuizJunior
Copy link

It's an error in react-native class -> node_modules/react-native/Libraries/Blob/URL.js

For some reason inside the class they are having to type as variables in a .js file
If you remove everything like typing, it works again.

Example:
To alter
append(key: string, value: string) -> append(key, value)

@joshua-davis-rose
Copy link

FWIW, the issue doesn't appear to be happening in RN 0.66.x

@joshua-davis-rose
Copy link

It's an error in react-native class -> node_modules/react-native/Libraries/Blob/URL.js

For some reason inside the class they are having to type as variables in a .js file If you remove everything like typing, it works again.

Example: To alter append(key: string, value: string) -> append(key, value)

For 0.63.x at least, that file hasn't changed in almost 2 years so it shouldn't suddenly be breaking now. There must be another dependency that has changed recently that is causing this error.

@fabio-jreis
Copy link

It's an error in react-native class -> node_modules/react-native/Libraries/Blob/URL.js

For some reason inside the class they are having to type as variables in a .js file If you remove everything like typing, it works again.

Example: To alter append(key: string, value: string) -> append(key, value)

doesn't work for me 😭

@joshua-davis-rose
Copy link

This appears related to babel, not react-native. I believe the issue is "@babel/traverse" 7.16.8: babel/babel#14139

@joshua-davis-rose
Copy link

joshua-davis-rose commented Jan 12, 2022

I finally got it to work by setting explicit versions in my devDependencies and resolutions. I also needed to delete my node_modules and yarn.lock, but YMMV. I went back to 7.16.5 since it was the upgrade to 7.16.7 that I first saw the issue, but the latter may be safe.

"devDependencies": {
    "@babel/core": "7.16.5",
    "@babel/preset-flow": "7.16.5",
    "@babel/runtime": "7.16.5"
}
"resolutions": {
    "@babel/traverse": "7.16.5"
}

@qcmoke
Copy link

qcmoke commented Jan 12, 2022

Facing the same issue on RN 0.62.2

@quyle1222
Copy link

quyle1222 commented Jan 13, 2022

I finally got it to work by setting explicit versions in my devDependencies and resolutions. I also needed to delete my node_modules and yarn.lock, but YMMV. I went back to 7.16.5 since it was the upgrade to 7.16.7 that I first saw the issue, but the latter may be safe.

"devDependencies": {
    "@babel/core": "7.16.5",
    "@babel/preset-flow": "7.16.5",
    "@babel/runtime": "7.16.5"
}
"resolutions": {
    "@babel/traverse": "7.16.5"
}

Don't work for me @@
I try delete node_modules and npm install ,after, cd android and run ./gradlew clean => run success android

@trabk1992
Copy link
Author

trabk1992 commented Jan 13, 2022

now, i found solution to fix this issue .
my solution :
"devDependencies": {
"@babel/core": "7.16.5",
"@babel/preset-flow": "7.16.5",
"@babel/runtime": "7.16.5",
"@babel/traverse": "7.16.5"
}

@qianqiang2017
Copy link

Facing the same issue on RN 0.59.9

@kerm1it
Copy link
Contributor

kerm1it commented Jan 13, 2022

babel/babel#14139 (comment)

@Satur-nity
Copy link

babel/babel#14139 (comment)

it works for me.

Thanks

@kurashiva11
Copy link

same error with
RN: 0.62.2
"@babel/core": "7.16.5",
"@babel/runtime": "7.16.5",
"@babel/traverse": "7.16.5",
"@babel/preset-flow": "7.16.5",
"babel-jest": "24.9.0",
"metro-react-native-babel-preset": "0.59.0"

I have uninstalled node_modules, cleaned Gradle build, re-installed everything and started the app. but still, it is showing the same error.

@kerm1it
Copy link
Contributor

kerm1it commented Jan 13, 2022

same error with RN: 0.62.2 "@babel/core": "7.16.5", "@babel/runtime": "7.16.5", "@babel/traverse": "7.16.5", "@babel/preset-flow": "7.16.5", "babel-jest": "24.9.0", "metro-react-native-babel-preset": "0.59.0"

I have uninstalled node_modules, cleaned Gradle build, re-installed everything and started the app. but still, it is showing the same error.

try yarn start --reset-cache to start app,maybe the error build cache is exist.

@fabio-jreis
Copy link

babel/babel#14139 (comment)

works here!

@nicolo-ribaudo
Copy link

If the solution in the Babel repository doen't work for someone, we will need a repository that we can use to reproduce the bug.

@milkcask
Copy link

Drop-in replacement metro-react-native-babel-preset, and running npx react-native start --reset-cache work for me.

@Hello-Alex-Cheng
Copy link

change your babel.config.js file

presets: [[
    'module:metro-react-native-babel-preset',
    {
      unstable_disableES6Transforms: true
    }
]],

@ahmedelsayed11
Copy link

Monday

What to make in that file ?

@SyedSaifAli
Copy link

change your babel.config.js file

presets: [[
    'module:metro-react-native-babel-preset',
    {
      unstable_disableES6Transforms: true
    }
]],

Not working with this change as well.

@HeyShinner
Copy link

babel/babel#14139 (comment)

It works!!

@bsdaoquang
Copy link

It's an error in react-native class -> node_modules/react-native/Libraries/Blob/URL.js

For some reason inside the class they are having to type as variables in a .js file If you remove everything like typing, it works again.

Example: To alter append(key: string, value: string) -> append(key, value)

Thank you so much, it fixed this error

@kelokchan
Copy link

I can confirm after bumping metro-react-native-babel-preset to 0.59.0 and running npx react-native start --reset-cache everything works again

Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 13, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests