-
Apr 8th, 2024, 09:55 PM
#1
Thread Starter
Fanatic Member
React Native I created an application that reported an TypeError ?
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: https://yarnpkg.com
npm WARN deprecated @babel/plugin-proposal-optional-catch-binding@7.18.6: 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/plugin-proposal-numeric-separator@7.18.6: 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/plugin-proposal-nullish-coalescing-operator@7.18.6: 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/plugin-proposal-class-properties@7.18.6: 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/plugin-proposal-optional-chaining@7.21.0: 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/plugin-proposal-object-rest-spread@7.20.7: 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/plugin-proposal-async-generator-functions@7.20.7: 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
-
Oct 15th, 2024, 12:27 PM
#2
New Member
Re: React Native I created an application that reported an TypeError ?
It looks like you're encountering an issue with the old react-native-cli package, which is no longer supported. The error comes from trying to use a deprecated CLI. To fix this, you should use the modern npx react-native command, which doesn't require installing the global CLI.
First, uninstall the old CLI by running: npm uninstall -g react-native-cli
Then, create your project again using the recommended approach: npx react-native init demotsx
This should resolve the issue since it will ensure you're using the latest setup without relying on deprecated tools.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|