[英]npm start throwing error when trying to create a react app
I am new to web development using react.我是使用 react 开发 web 的新手。 So, i did the following - npm install -g create-react-app create-react-app my-app cd my-app npm start
所以,我做了以下 - npm install -g create-react-app create-react-app my-app cd my-app npm start
But, it is throwing a error which are as follows:但是,它会抛出一个错误,如下所示:
E:\Study\React-course\React-app\my-app>npm start
> my-app@0.1.0 start E:\Study\React-course\React-app\my-app
> react-scripts start
i 「wds」: Project is running at http://192.168.1.5/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from E:\Study\React-course\React-app\my-app\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:291
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\asus\AppData\Roaming\npm-cache\_logs\2020-07-20T07_10_52_845Z-debug.log
E:\Study\React-course\React-app\my-app>
Instead of using this (npm install -g create-react-app create-react-app) try creating react app using ( npx create-react-app my-app) And for more clarification follow this https://create-react-app.dev/docs/getting-started/而不是使用这个 (npm install -g create-react-app create-react-app) 尝试使用 (npx create-react-app my-app) 创建反应应用程序并且为了更清楚地遵循这个https://create-react- app.dev/docs/getting-started/
Please do not write a special character on your local system folder请不要在本地系统文件夹中写入特殊字符
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.