Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reactjs "Error: ENOENT: no such file or directory, open.." after converting jsx file to tsx

I have a create-react-app app and I am translation files from jsx to typescript. For example, one file is called /code/app_react/src/common/Action.jsx and I renamed it to /code/app_react/src/common/Action.tsx. I made the necessary changes to successfully convert it to tsx, but I am getting an error related to the name change:

./src/common/Action.jsx Error: ENOENT: no such file or directory, open '/code/src/common/Action.jsx'

  • rebuilding the does not help
  • for some reason, the old version of the file is expected

The file importing this file is a jsx file, but now I am importing a tsx file into it.

This is a CRA app, so is there a correct way to clear this error?

SOLUTION: I had to remove them from the git repository, using the git rm command, like this:

git rm /code/src/common/Action.jsx 

Once I did that, it removed the jsx from the committed files and then I was able to use the new tsx files

like image 653
thehme Avatar asked Mar 06 '19 03:03

thehme


People also ask

What does error Enoent mean?

It's an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories. It's abbreviated because C compilers at the dawn of time didn't support more than 8 characters in symbols. Follow this answer to receive notifications. edited Jun 4, 2019 at 14:30. community wiki.


1 Answers

Killed my yarn process running, killed vscode, re-started both and it works

like image 94
Code Wiget Avatar answered Sep 22 '22 07:09

Code Wiget