. Advertisement .
. Advertisement .
While attempting to execute your React Native project, a notification may come across as “TypeError: cli.init is not a function” in your command panel. If you are looking for solutions for this error, we will give you details about this error and solutions to solve it.
How Does The Error “TypeError: cli.init is not a function” Occur?
From React Native version 0.69, the error “TypeError: cli.init is not a function” may occur if you run the program on this framework. The error message shows up as below.
TypeError: cli.init is not a function
Here are various solutions to this issue so you can get on with your work.
How To Solve The Error “TypeError: cli.init is not a function”?
METHOD 1: Downgrade React Native Version
As mentioned above, the error “TypeError: cli.init is not a function” appears on React Native version 0.69. If you recently updated it to the latest version, you need to downgrade it to version 0.68.2 to continue your work. To downgrade React Native, open the terminal and run the following command.
npx react-native init YourProjectName --version 0.68.2
Now try to run your program to see if it is functioning correctly.
This first solution here is simple and efficient for solving this error. Try the second option below if you do not want to adopt this method.
METHOD 2: Reinstall React Native
Reinstalling may be preferable if you want to utilize the most recent version of React Native with the newest features.
First, you need to uninstall the current React Native version.
npm uninstall -g react-native-cli
Then install new react-native global.
npm install -g react-native-cli && npm install -g react-native
You can now create a new project and work again.
npx react-native init AwesomeProject
Above are the solutions we found efficient to resolve the error “TypeError: cli.init is not a function”. We hope that you can quickly fix this error with the methods we provide.
“TypeError: cli.init is not a function” is an error you may face when trying to run your code in React Native version 0.69. With the two solutions listed above, this problem will be fixed, and you may continue your programming. What do you think? Do you have any queries regarding this article? To help us, kindly comment below. Thank you for reading!