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 identifier 'invariant'. import call expects exactly one argument. no stack #32888

Closed
ceyanesb opened this issue Jan 14, 2022 · 22 comments
Labels
Accessibility Team - Evaluated Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@ceyanesb
Copy link

Description

So Xcode got updated to the 13.2.1 version and since that update I am no being able to run the app. It builds successfully but doesn't run, this error shows up:

Screen Shot 2022-01-14 at 1 17 54 PM

I tried recloning the app but it doesn't work, also I build and run another react native app and it works normally and also download the simulators for iOS 15 because the update brings the 15.2 which is the latest iOS version.

Please help.

Version

0.64.2

Output of npx react-native info

System:
    OS: macOS 12.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 190.46 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.18.1 - ~/.nvm/versions/node/v12.18.1/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v12.18.1/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v12.18.1/bin/npm
    Watchman: 2021.11.15.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 23, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 32.0.0
      System Images: android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.8 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.2 => 0.64.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

yarn install
cd ios
pod install
cd ..
react-native run-ios

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

No response

@misterbo271
Copy link

misterbo271 commented Jan 18, 2022

I have a similar issue: Unhandled JS Exception: Unexpected identifier '_classCallCheck'. import call expects exactly one argument.
no stack
Please helps me
Simulator Screen Shot - iPhone 13 - 2022-01-18 at 13 12 40

@Arslan106
Copy link

getting the same issue , still waiting for some positive response

@anilkarwa
Copy link

getting same issue since last week, no solution found yet.

@restuhaqza
Copy link

I also got problem after upgrade my react-native to 0.67.

@rajvisma
Copy link

rajvisma commented Jan 20, 2022

I am also getting same issue with react-native version 0.67.0. Can anyone please help me to solve this

@boriszv
Copy link

boriszv commented Jan 20, 2022

Same issue on react-native version 0.66.4 and 0.67.0

@larsgroeber
Copy link

We have the same issue with react-native 0.64.2 and xcode 13.2.1 and 13.2. Downgrading xcode to 13 helped us to run the app successfully again.

@Arslan106
Copy link

i already have xcode 13 but still getting this issue

@Joan0018
Copy link

Joan0018 commented Jan 25, 2022

I have a similar issue: Unhandled JS Exception: Unexpected identifier '_classCallCheck'. import call expects exactly one argument. no stack Please helps me Simulator Screen Shot - iPhone 13 - 2022-01-18 at 13 12 40

@misterbo271 May I know is there any solution for this problem?

@Arslan106
Copy link

Arslan106 commented Jan 25, 2022

Thank God after days of work this silly issue resolved on my side

In my case it was babel, actually i removed the yarn.lock file and after a fresh yarn the babel version was updated so its creating this issue, so what i did i just revert the yarn.lock file and remove ( ^ ) from "@babel/core" version and did a yarn and then it works.... hope it will help
my current babel/core version is "@babel/core": "7.12.9",

i changed this
"@babel/core": "^7.12.9",
to this
"@babel/core": "7.12.9",

@mojvan
Copy link

mojvan commented Jan 27, 2022

I have a similar issue: Unhandled JS Exception: Unexpected identifier '_classCallCheck'. import call expects exactly one argument. no stack Please helps me Simulator Screen Shot - iPhone 13 - 2022-01-18 at 13 12 40

This is amazing error
please help

@haorh
Copy link

haorh commented Jan 28, 2022

Thank God after days of work this silly issue resolved on my side

In my case it was babel, actually i removed the yarn.lock file and after a fresh yarn the babel version was updated so its creating this issue, so what i did i just revert the yarn.lock file and remove ( ^ ) from "@babel/core" version and did a yarn and then it works.... hope it will help my current babel/core version is "@babel/core": "7.12.9",

i changed this "@babel/core": "^7.12.9", to this "@babel/core": "7.12.9",

Editing yarn.lock/package-lock.json is just a temporary solution as yarn lock could be automatically be edited in the future. Fixing babel/core to specific version points me to the right direction.
Initially my package.json was this

{
  "scripts": {
    ...
  },
  "dependencies": {
...
  },
  "devDependencies": {
    "appcenter-cli": "1.2.2",
    "babel-eslint": "10.0.2",
    "babel-jest": "23.4.0",
    "babel-plugin-module-resolver": "4.1.0",
    "babel-plugin-transform-remove-console": "6.9.4",
    "chalk": "4.1.0",
    "eslint": "6.0.1",
    "eslint-config-airbnb": "17.1.1",
    "eslint-plugin-import": "2.18.0",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-react": "7.14.2",
    "jest": "23.4.1",
    "metro-react-native-babel-preset": "0.51.1",
    "react-native-console-time-polyfill": "1.2.1",
    "react-native-schemes-manager": "2.0.0",
    "react-test-renderer": "16.6.3"
  },
}

my node is 10.15.3
@babel/core@7.12.9 gave me 'error Cannot read property 'transformFile' of undefined'. I have to set @babel/core to 7.5.0 using npm-force-resolutions, but it leads to .babelrc: Error while parsing config - Cannot find module 'json5'. so i had to install babel-loader

final version is

{
  ...
  "scripts": {
   ...
    "preinstall": "npx npm-force-resolutions",
   ...
  },
  "dependencies": {
    ...
    "npm-force-resolutions": "0.0.10",
    ...
  },
  "devDependencies": {
    "@babel/core": "7.5.0", <--
    "appcenter-cli": "1.2.2",
    "babel-eslint": "10.0.2",
    "babel-jest": "23.4.0",
    "babel-loader": "8.0.5", <--
    "babel-plugin-module-resolver": "4.1.0",
    "babel-plugin-transform-remove-console": "6.9.4",
    "chalk": "4.1.0",
    "eslint": "6.0.1",
    "eslint-config-airbnb": "17.1.1",
    "eslint-plugin-import": "2.18.0",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-react": "7.14.2",
    "jest": "23.4.1",
    "metro-react-native-babel-preset": "0.51.1",
    "react-native-console-time-polyfill": "1.2.1",
    "react-native-schemes-manager": "2.0.0",
    "react-test-renderer": "16.6.3"
  },
  "resolutions": {
    "@babel/core": "7.5.0"
  },
}

@ceyanesb
Copy link
Author

I changed the babel version thinking that was the problem but it wasn’t. I restarted my computer and cleaned builds from Xcode and also cleaned cache for react native and yarn/npm and then the app runs ok.

Please try this and let me know if this worked for you guys

@ghost
Copy link

ghost commented Jan 28, 2022

Tried everything mentioned above still its not working for me.

@marciodajr
Copy link

Hey guys! 😎

When we copy or clone a project. The package.json file always comes with a caret "^" in front of the versions of some packages. That is, when we run the installation (npm/yarn) the packages will be updated. 😱

It worked for me! 👌

Recommend using this site 😏 React Native Upgrade Helper by selecting your React Native version and adjusting the version number in package.json file. Then remove the node_modules folder and the file (
package-lock.json or yarn.lock) and run the install command and be happy! 🤩

🏆 Gold tip: To avoid errors like this in the future, remove the "^" cases from versions.

@dmalfaro
Copy link

dmalfaro commented Feb 2, 2022

I have the same issue. I tried the suggested solution but nothing works. My versions are
`"react-native": "0.62.2",

"@babel/core": "7.6.2",
"@babel/runtime": "7.6.2",
"babel-eslint": "10.1.0",
"babel-jest": "24.9.0",
"babel-plugin-inline-import": "3.0.0",
"babel-plugin-module-resolver": "4.0.0",
`
Please help, I've facing this issue since last week.

@dmalfaro
Copy link

dmalfaro commented Feb 2, 2022

for anyone still having this issue, this is what fixed mine

https://github.com/babel/babel/issues/14139

@micahgoodman
Copy link

for anyone still having this issue, this is what fixed mine

https://github.com/babel/babel/issues/14139

This worked for me too. Specifically, updating my babel.config.js

@younasm
Copy link

younasm commented Feb 16, 2022

I have a similar issue: Unhandled JS Exception: Unexpected identifier '_classCallCheck'. import call expects exactly one argument. no stack Please helps me Simulator Screen Shot - iPhone 13 - 2022-01-18 at 13 12 40

Same here any help!

@davvvvsss
Copy link

Same

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 Mar 30, 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 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Team - Evaluated 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