while running npx react-native init appName in MacBook air M1 chip
TypeError: cli.init is not a function
at run (/opt/homebrew/lib/node_modules/react-native-cli/index.js:302:7)
at createProject (/opt/homebrew/lib/node_modules/react-native-cli/index.js:249:3)
at init (/opt/homebrew/lib/node_modules/react-native-cli/index.js:200:5)
at Object.<anonymous> (/opt/homebrew/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
CodePudding user response:
That is error is from the new version 0.69.0 You can use npx react-native init ProjectName --version 0.68.2
and then upgrade to v 0.69 later.
CodePudding user response:
Need to clean global environments with following commands:
yarn global remove react-native
yarn global remove react-native-cli
npm uninstall -g react-native
npm uninstall -g react-native-cli
check that nothing related to react-native presents in these lists:
yarn global list, npm -g list
then you can run:
npx react-native init ProjectName