Recently I was trying to run my react-native project, unluckily it is not working for me and it is showing me the error: TypeError: cli.init is not a function in React-native.
When I was trying to run my react-native project so it is showing me the below error:
TypeError: cli.init is not a function
I tried multiple methods to fix the error, I would be sharing the methods which worked for me to fix the TypeError: cli.init is not a function in React-Native.
Why TypeError: cli.init is not a function Occurred?
This error basically occurred because of React Native upgrade to its latest released 0.69.0 version. So to fix the error, you need to downgrade your react-native version back to 0.68.2 to fix the TypeError: cli.init is not a function Error.
How to Fix TypeError: cli.init is not a function?
To fix the Error, you need to downgrade your react-native version back to 0.68.2 version from your recently upgraded version 0.69.0.
Below is the step by step process you can follow to downgrade the react-native version to working 0.68 version:
Fix 1: Downgrade react-native Version
Use the below command to downgrade your recent react-native 0.69.0 Version to the 0.68.2 version:
npx react-native init CurrentProjectName --version 0.68.2
Now try to run the project again, It would solve the TypeError: cli.init is not a function error for you immediately.
Conclusion
This error basically occurred because of React Native upgrade to its latest released 0.69.0 version. So to fix the error, you need to downgrade your react-native version back to 0.68.2 to fix the TypeError: cli.init is not a function Error.