androidreactjsreact-nativeexporeact-android

create-react-native-app confusion is not creating App.js file


I am trying to create a React-native application environment using

create-react-native-app confusion

but it is not creating all the files. It is only creating package.json and yarn.lock inside the confusion folder, App.js is missing and I am getting the below mentioned error.

Creating a new React Native app in E:\Developer's Area\ReactNative-Projects\confusion.

Using package manager as yarnpkg with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...

yarn add v1.22.5
info No lockfile found.
[1/4] Resolving packages...
warning react-native-scripts > babel-runtime > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 20 new dependencies.
info Direct dependencies
└─ react-native-scripts@2.0.1
info All dependencies
├─ ansi-styles@3.2.1
├─ babel-runtime@6.26.0
├─ chalk@2.4.2
├─ color-convert@1.9.3
├─ color-name@1.1.3
├─ core-js@2.6.12
├─ cross-spawn@5.1.0
├─ escape-string-regexp@1.0.5
├─ has-flag@3.0.0
├─ isexe@2.0.0
├─ lru-cache@4.1.5
├─ minimist@1.2.5
├─ pseudomap@1.0.2
├─ react-native-scripts@2.0.1
├─ regenerator-runtime@0.11.1
├─ shebang-command@1.2.0
├─ shebang-regex@1.0.0
├─ supports-color@5.5.0
├─ which@1.3.1
└─ yallist@2.1.2
Done in 2.78s.
(node:9952) UnhandledPromiseRejectionWarning: Error: Cannot find module 'E:\Developer's Area\ReactNative-Projects\confusion\node_modules\react-native-scripts\build\scripts\init.js'
Require stack:
- C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\create-react-native-app\build\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at _callee2$ (C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\create-react-native-app\build\index.js:128:32)
    at tryCatch (C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\regenerator-runtime\runtime.js:296:22)
    at Generator.prototype.<computed> [as next] (C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at C:\Users\sans\AppData\Local\Yarn\Data\global\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13
(node:9952) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9952) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS E:\Developer's Area\ReactNative-Projects> 

This is how I set up my app

yarn global add create-react-native-app@1.0.0
create-react-native-app confusion
yarn start

Solution

  • create-react-native-app@1.0.0 is not supported anymore, that version was released 4 years ago and the latest version is 3.5.3. you can leave out the version to get the latest - yarn global add create-react-native-app or use yarn create react-native-app or npx create-react-native-app.

    also, if you're looking to create a managed expo project, i'd suggest installing expo-cli instead - npm i -g expo-cli and then run expo init. full installation docs here.