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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With