[英]After creating app using npx create-react-app <myproject> , and start app by using "npm start" i got this error mentioned below
[英]npm start on cmd after creating react app always gives error
我创建了一个简单的 React 应用程序并成功了,因为它已经在 cmd 上显示了快乐的黑客消息,但是当我在 cmd 上键入并运行“npm start”时,它给出了很多错误。 我已经尝试卸载然后安装节点和 npm 几次,但它仍然无法正常工作。 这是错误消息
Creating a new React app in C:\myapp2.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> core-js@2.6.10 postinstall C:\myapp2\node_modules\babel-runtime\node_modules\core-js
> node postinstall || echo "ignore"
> core-js@3.2.1 postinstall C:\myapp2\node_modules\core-js
> node scripts/postinstall || echo "ignore"
+ react-dom@16.11.0
+ react@16.11.0
+ react-scripts@3.2.0
added 1475 packages from 693 contributors and audited 904933 packages in 828.526s
found 0 vulnerabilities
Success! Created myapp2 at C:\myapp2
Starting the development server...
events.js:187
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456: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:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp2@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp2@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\2019-11-13T21_57_29_371Z-debug.log
我希望你们能帮助我指出我应该在哪里进行更改,以便它能够成功运行。 提前致谢 !
使用 create-react-app 创建项目后
create-react-app name
你必须在创建的文件夹中 go
cd name
然后运行
npm start
再次
首先在一个驱动器(D:或E:)中创建一个文件夹,在命令提示符下打开它并创建一个反应应用程序,如:
npm create-react-app 项目名称
或者
npx-create-react-app 项目名称 cd 项目名称 npm start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.