Error Reference › Linux / Server
Linux / Server
No such file or directory
The path you referenced doesn't exist (at least not from where the process is running).
What it looks like
bash: ./run.sh: No such file or directory
Error: ENOENT: no such file or directory, open 'config.json'
What does "No such file or directory" mean?
Reported when a path does not exist from where the process is looking (ENOENT in Node and C programs). Relative paths are resolved against the current working directory, which is often not where the script lives.
What causes "No such file or directory"?
- A typo or wrong relative path.
- Different working directory than you assumed.
- The file wasn't created/deployed.
How do I confirm the cause?
- Print the current working directory (pwd, process.cwd(), getcwd()) and the full path being opened.
- For a script that plainly exists, check its first line: Windows line endings or a wrong #! interpreter path produce this same error.
- Check the file was actually deployed or created — and that the name’s case matches on case-sensitive systems.
How do I fix "No such file or directory"?
- Check the exact path; print the current working directory.
- Use an absolute path or resolve relative to the script.
- Confirm the file exists and is deployed.
How do I stop it happening again?
- Build paths relative to the script’s own location (__DIR__, path.join(__dirname, …)) instead of the working directory.
- Save shell scripts with Unix (LF) line endings.