Dong Lam Trien

Dong Lam Trien

  • 798
  • 986
  • 142.2k

React Native I created an application that reported an TypeErro ?

Apr 9 2024 2:57 AM

React Native I created an application that reported an error, TypeError: cli.init is not a function ?

How do I fix this error ? See the error below:

D:\>npx react-native init demotsx
This will walk you through creating a new React Native project in D:\demotsx
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Installing react-native...
Consider installing yarn to make this faster: 
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.

added 600 packages, and audited 601 packages in 54s

45 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
C:\Users\win10\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\win10\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
    at createProject (C:\Users\win10\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\win10\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at Object.<anonymous> (C:\Users\win10\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.12.1

 


Answers (6)