ENOENT: no such file or directory: How to Fix It | SheCodes

File not found · Usually quick to fix

ENOENT: no such file or directory

Your code is looking for a file that doesn’t exist at the specified path.

What the error looks like

Error: ENOENT: no such file or directory, open '/app/.env'

Why it happens

The file was deleted, moved, or the path is wrong. This can also happen if you haven’t created a file that your code expects.

How to fix it

  1. Double-check the file path in the error message
  2. Make sure the file exists where your code expects it
  3. If it’s a config file, you may need to create it first

Ask your AI coding tool to fix it

Paste this prompt into Claude Code, Cursor, Bolt or Lovable, with your own error in place of the example.

I'm getting this error and I need help understanding and fixing it:

```
Error: ENOENT: no such file or directory, open '/app/.env'
```

Please:
1. Explain what this error means in plain English
2. Tell me the most likely cause
3. Give me the exact code changes or commands I need to fix it
4. Show me how to prevent this error in the future

Got a different error?

Paste any error into the free Error Decoder and get it explained in plain English, with a fix prompt.

Decode my error

More common errors explained