Home > Blockchain >  TypeError: cli.init is not a function
TypeError: cli.init is not a function

Time:10-26

I'm trying to create a react-native project on windows, but I'm getting this error.

TypeError: cli.init is not a function
    at run (C:\Users\oktay\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
    at createProject (C:\Users\oktay\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\oktay\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at Object.<anonymous> (C:\Users\oktay\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

Based on the react native documentation, I tried to create a project with the following command.

npx react-native init AwesomeProject

npm version : 8.19.2
react-native-cli version : 2.0.1

CodePudding user response:

Use this.

npx create-react-native-app

Npm Docs: https://www.npmjs.com/package/create-react-native-app

  • Related