TypeError: cli.init is not a function – React Native

This error will come while running the following command.

This happens because react-native-cli is deprecated and not compatible with recent versions of node js. Especially from Node 18 + it throws this error.

To fix this issue first Uninstall react-native-cli using the following command.

use the official CLI as follows

Now it will install all the required packages to run the App.