Error: ENOENT: no such file or directory after git checkout

Viewed 66

When I change git branch while a react project is running, the CRA(create-react-app) reports an error 'Error: ENOENT: no such file or directory', if some files are deleted after the branch change. Error does not dissapear on recompile, even if there aren't any imports of that file, only cra restart helps.

Also, sometimes, if I delete a file, which is imported in another files, I also get such error and recompile doesn't help as well(but sometimes it helps).

I don't understand why it happens, why CRA can't 'forget' about deleted files when they aren't used(imported) anymore? My project needs about 2 minute to run, so frequent restarts take a lot of time.

I am on Linux(ubuntu 20.04), I don't know if such problem happens in windows or any other OS.

Maybe you had somehow solve such problem?

0 Answers
Related