[英]Problem with npm start (error : spawn cmd ENOENT)
我的申请有问题。 因为之前当我创建一个应用程序时它工作,但现在,它向我显示了这个错误,我不知道为什么以及我必须做的事情来修复它。
你有什么想法可以帮助我吗? (这是一个 reactJS 应用程序)。
我检查了一些 stackoverflow 主题,但在我检查的所有地方,这并不是一个真正有效的答案。
events.js:180
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:77:11)
Emitted 'error' event 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:77:11) {
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! fix-react-module@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fix-react-module@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\Lucas\AppData\Roaming\npm-cache\_logs\2019-07-16T09_33_39_111Z-debug.log
将C:\\Windows\\System32添加到全局 PATH 环境变量中。
解决方案1
将您的环境变量设置为 C:\\Windows\\System32 。 这对我有用。
解决方案2
如果第一个不起作用,请按照第二个步骤操作。 导航到您的项目文件夹并键入此命令 >>>
rm -rf node_modules
rm package-lock.json
rm yarn.lock
npm cache clear --force
npm install
解决方案3
降级 package.json 文件中的 react-scripts
尝试安装 Mongo DB 后,我遇到了同样的问题。 我发现这个问题只存在于 react-scripts@3.0.0。 尝试使用不同的 React 脚本版本重新安装 npm。 只需在命令中转到您的文件夹并像这样重新安装:
npm install react-scripts@2.1.8
npm start
之后,该应用程序再次为我工作。
对于所有因反应脚本未启动而遇到此问题的人。 解决办法是
C:\\Windows\\System32
。如果有人在 Angular 2+ 中遇到这个问题,请从 ng serve 中删除 --open 或在没有此选项的情况下运行。
运行以下命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.