反应开发服务器未启动

react development server not starting

我使用命令“npx create-react-app”制作了一个 React 应用程序,我尝试启动开发服务器而不使用“npm start”对其进行任何更改,但它以这个错误结束

图片:https://i.stack.imgur.com/r28sS.png

这是日志文件

0 verbose cli [
0 verbose cli   'C:\Program Files\nodejs\node.exe',
0 verbose cli   'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
0 verbose cli   'start'
0 verbose cli ]
1 info using npm@8.1.0
2 info using node@v16.13.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:T:\t\Projects\React.js\.npmrc Completed in 1ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:C:\Users\thevi\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\thevi\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 14ms
19 timing npm:load:configload Completed in 14ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 7ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 31ms
27 timing command:run-script Completed in 3ms
28 timing command:start Completed in 16ms
29 verbose stack Error: ENOENT: no such file or directory, open 'T:\t\Projects\React.js\package.json'
30 verbose cwd T:\t\Projects\React.js
31 verbose Windows_NT 10.0.22000
32 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
33 verbose node v16.13.0
34 verbose npm  v8.1.0
35 error code ENOENT
36 error syscall open
37 error path T:\t\Projects\React.js/package.json
38 error errno -4058
39 error enoent ENOENT: no such file or directory, open 'T:\t\Projects\React.js\package.json'
40 error enoent This is related to npm not being able to find a file.
41 verbose exit -4058

您应该首先转到您的项目目录,在您的情况下它称为 anatha_1

所以,运行 cd anatha_1,然后 npm start

npm start 或任何其他 npm 脚本,在当前工作目录中查找 package.json 文件。

也是create-react-app在其输出的最后写的,所以请遵循指南。