I think you forgot to cd
into (or to change to) your project's directory.
Assuming that you initialised your project in the directory C:UsersDavid
and gave the project name my-app
, just type cd my-app
(or to be precise type cd C:UsersDavidmy-app
in your Command Prompt and then run npm start
.
The file the error message is complaining about, package.json
, is already available inside your project folder.
However, installing create-react-app
and then initialising a new app is not the new recommended way.
According to the React documentation, uninstall the create-react-app
global npm package and follow the following steps to create a new React app:
npx create-react-app my-app
cd my-app
npm start
Note
npx
on the first line is not a typo — it’s a package runner tool that
comes with npm 5.2+.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…