Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why react-native-cli giving errors?

I recently installed react native cli globally. When i tried to start a project using react-native init projectname or npx react-native init projectname it started downloading packages and creating the project. After completion it gave this error

    cli.init(root, projectname);
      ^

typeerror: cli.init is not a function
    at run (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:302:7)
    at createproject (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at object.<anonymous> (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at module._compile (node:internal/modules/cjs/loader:1105:14)
    at object.module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at module.load (node:internal/modules/cjs/loader:981:32)
    at function.module._load (node:internal/modules/cjs/loader:822:12)
    at function.executeuserentrypoint [as runmain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

What is causing this problem?

like image 318
aslamjm Avatar asked Mar 20 '26 00:03

aslamjm


1 Answers

Probably you are have and using old react-native-cli, try to:

npm uninstall -g react-native-cli or yarn global remove react-native-cli

and then run npx react-native init projectname again.

like image 60
Alex Ivanov Avatar answered Mar 22 '26 16:03

Alex Ivanov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!