react-native: Unhandled JS Exception: Unexpected identifier 'invariant'. import call expects exactly one argument. no stack
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:
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 22
I have a similar issue: Unhandled JS Exception: Unexpected identifier ‘_classCallCheck’. import call expects exactly one argument. no stack Please helps me
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.
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
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
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",
for anyone still having this issue, this is what fixed mine
https://github.com/babel/babel/issues/14139
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
@misterbo271 May I know is there any solution for this problem?