React Native is one of the most popular front-end tools for developing cross-platform mobile apps. While the framework itself is rather easy to use and understand, random bugs and glitches still keep popping up from time to time.
In this article, we’re talking about “Typeerror: Cli.init is not a function” error with React Native when making a new project.
What causes this error?
The error is mainly caused by a bug on React-native version 0.69.0 when you try to initialise a new project. You can either choose to downgrade to version 0.68.2 or install a new global installation to circumvent this.
Also read: What is the unexpected reserved word await error in Javascript?
How to fix this error?
Here are two fixes you can try out.
Try using an older version
The simplest way of resolving this error is to use react-native version 0.68.2 as shown below.
npx react-native init ProjectName --version 0.68.2
Once the project has been initialised, you can upgrade to version 0.69.0 without any hassle.
Do a fresh installation
Alternatively, you can also run a new installation of react-native to go around the problem.
Step 1: Uninstall the present react-native version.
npm uninstall -g react-native-cli
Step 2: Install the new version using the commands below.
npm install -g react-native-cli
npm install -g react-native
Step 3: Initialise your project as usual.
npx react-native init ProjectName
React-native should work without any issues after the update.
Also read: How to fix ‘cannot parse response’ error in Safari?