reactjs - 当尝试运行 react-bootstrap 或一般只做出反应时,我总是得到 events.js:287 和其他错误,如下所示
问题描述
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84: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! 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\JoseH\AppData\Roaming\npm-cache\_logs\2020-05-08T20_10_31_948Z-debug.log
The terminal process terminated with exit code: 1
这总是会出现的,我不知道该怎么做才能解决这个问题,我对使用反应相当陌生,我想知道我能做些什么来解决这个问题。我尝试使用 npm 清除缓存,但没有奏效。我不确定如何更改正在使用的端口,但如果有人可以帮助我,我觉得这可能会奏效。
解决方案
检查您的 package.json 以获取值为 react-scripts start 的启动键
"scripts": {
"start": "react-scripts start", //as its here
"build": "react-scripts build",
"test": "jest --coverage --coverageDirectory=output/coverage/jest",
"eject": "react-scripts eject"
},
如果它不存在,则将其更改为如上所示
如果它仍然不起作用,请运行
npm install
如果它仍然存在..尝试使用此清理缓存
npm cache clean --force
希望这可以帮助!
推荐阅读
- xml - 与“manifest”元素类型关联的“android:versionCode”属性的“android”前缀未链接
- javascript - 用于限制图标选择 onclick eventlistener 的 Javascript 代码
- datatables - 具有水平和垂直滚动的 Jquery DataTables 使浏览器仅对 50 条记录无响应
- c# - 如何在不更改 tiff 文件 DPI 的情况下在 Tiff 文件中插入图像?
- c - 检查块驱动程序中的非文件系统请求
- oracle - 如何将纬度,经度(字符串)转换为坐标
- git - 如何记录使用旧路径重命名/移动的文件的整个 git 历史记录?
- systemd - 无论挂载点如何,systemd 可以在每次挂载后运行脚本吗?
- java - Maven 编译失败,没有迹象表明可能导致它的原因
- amazon-web-services - How to return less information from aws ec2 describe-instances