7

I'm learning React for the first time, and I'm having a great deal of trouble even getting started with a demo app. When I run npx create-react-app I get the following error:

enter image description here

This is on Windows 10, npm/npx version 6.4.1. I tried npm install and installing lodash using npm i -g lodash, which tells me lodash 4.17.11 is installed. But the create-react-app command is still generating the exact same error message.

This seems very bizarre. I've looked around online and cannot find any other references to this error as it relates to the create-react-app command, and the solutions on other answers (npm install/npm i -s lodash) are not working (-s requires that an app folder be created in advance of using create-react-app, but create-react-app requires that the app folder be completely empty).

How do I approach resolving this problem so that I can get started with building my first react app and learning the framework?

Update - package.json

The package.json is being deleted by the command, but if I open it in notepad++, the last version before the installer crashes seems to contain contain the following minimal information.

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-scripts": "2.0.3"
  }
}

The only file left over after the installation seems to be a package-lock.json, which is very lengthy 0.6mb. I can post it somewhere if needed.

2
  • Can you post your package.json file here? Commented Oct 3, 2018 at 17:21
  • @ShubhamJain It gets deleted by the installer, but I captured the text it contained just as the installer crashed. Commented Oct 3, 2018 at 17:35

2 Answers 2

11

I continued searching for similar problems that others have had, and someone suggested:

npm cache clean --force 

so I did that, then I did another:

npm i 

and ...

npm i -g create-react-app 

then the create-react-app command worked!!

I hope this helps someone in the future.

Sign up to request clarification or add additional context in comments.

1 Comment

you could also use the Yarn way yarn create react-app my-app This will fix your NPX problem, it did for me, rather than install the create-react-app again
1

did you try installing create-react-app? npm install -g create-react-app and then run create-react-app my-app

1 Comment

Yes the create-react-app is installed and runs, but it is crashing.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.