在创建 React 应用程序时我缺少什么吗?

Abh*_*adi 0 npm reactjs

我创建了一个反应应用程序,当我运行它时显示以下错误。首先,我认为我在创建应用程序时犯了一个错误。之后,我删除了它并创建了另一个应用程序,它显示了相同的错误!

events.js:200
  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:81: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:81:21) {
errno: 'ENOENT',
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! fruit_details@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fruit_details@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\abhis\AppData\Roaming\npm-cache\_logs\2020-01-09T06_29_21_939Z-debug.log
Run Code Online (Sandbox Code Playgroud)

小智 5

也许这是反应脚本的问题。只需在命令中转到您的文件夹并使用以下命令重新安装:

npm install react-scripts@2.1.8
npm start
Run Code Online (Sandbox Code Playgroud)