简体   繁体   English

如何解决React脚本启动时出现的“错误监视文件更改:ECONNRESET”错误?

[英]How to fix “Error watching file for changes: ECONNRESET” error on react-scripts start?

I'm running npm start on a CRA project and receiving this error after the application is runing for a brief period of time: 我正在CRA项目上运行npm start ,并且在应用程序运行了很短的一段时间后收到此错误:

Error watching file for changes: ECONNRESET 监视文件以查看更改时出错:ECONNRESET

I have been working on this project for over a couple of months and have never seen this error before, it started happening this morning. 我已经在这个项目上工作了几个月多了,并且从未见过这个错误,它从今天早上开始发生。 I'm sure no one else has changed anything in the project since I'm the only one working on it, also I have contacted my company tech support to make sure there hasn't been any modifications nor upgrades to my workstation or the local file server we use. 我确定没有人更改过该项目中的任何内容,因为我是唯一从事此项目的人,而且我已经与公司的技术支持联系,以确保没有对我的工作站或本地进行任何修改或升级我们使用的文件服务器。 Additionally, when running npm start on my colleague's machine it works as expected. 此外,在同事的机器上运行npm start ,它可以按预期工作。

This is the full error log I get in my shell: 这是我在shell中得到的完整错误日志:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: ECONNRESET
    at _errnoException (util.js:992:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1359:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-react-theme@0.1.0 start: `set PORT=3001 && react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-react-theme@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\luis\AppData\Roaming\npm-cache\_logs\2019-01-30T13_50_03_616Z-debug.log

My codebase is quite large for this project. 对于该项目,我的代码库很大。 Basically I state manage with Redux and make REST calls using a custom Middleware. 基本上,我声明使用Redux进行管理,并使用自定义的中间件进行REST调用。

I have read, in responses to other related issues, that I might be something with network requests. 针对其他相关问题,我已经读到我可能对网络提出要求。 But when I had errors while using the REST API before, all I used to be met with as a Redux error saying that it expects actions to be plain objects. 但是,当我以前使用REST API时遇到错误时,曾经遇到的所有问题都是Redux错误,原因是它期望动作是纯对象。 So, I'm not quite sure that my problem may come from a REST call. 因此,我不太确定我的问题是否可能来自REST调用。

Apparently deleting my project and pulling it again from the remote repository did the trick for me. 显然删除我的项目并从远程存储库中再次拉出它对我来说是成功的窍门。 Still I don't know what has actually caused the issue, but I strongly believe it was something cache related. 我仍然不知道是什么真正导致了此问题,但我坚信这与缓存有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM