When I install react native app in our folder by using comand "npx react-native init Sarfaraz"

Issue

C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302
cli.init(root, projectName);
^

TypeError: cli.init is not a function
at run (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
at createProject (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
at Object. (C:\Users\HP\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

Solution

This problem for new version 0.69.0

You can use 0.68.2 version.
Just execute the following:

npx react-native init ProjectName --version 0.68.2

Answered By – Md Ariful Islam Roni

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published