Errors / checked October 9, 2026
/bin/sh: 1: node: not found
The error
Mail or log output of a crontab job on Debian or Ubuntu, for a command that works fine when you run it in your terminal. node can be any command: npm, bun, python, php, docker.
Quick fix
- Run which node in your terminal and use that full path in the crontab line, for example /home/you/.nvm/versions/node/v22.11.0/bin/node /home/you/app/job.js.
- Or set PATH at the top of the crontab, on its own line, with the directories spelled out: PATH=/home/you/.bun/bin:/usr/local/bin:/usr/bin:/bin. crontab does not expand $PATH or ~ there.
- Test the line the way cron runs it: env -i HOME=$HOME PATH=/usr/bin:/bin /bin/sh -c 'your command'. If it works there, it will work under cron, since cron's PATH has at least /usr/bin and /bin.
Why this happens
cron does not read your shell profile, so nothing from .bashrc, .zshrc or .profile is set: not nvm, not ~/.bun/bin, not ~/.local/bin. Jobs run with /bin/sh (dash on Debian and Ubuntu, which prints "/bin/sh: 1: name: not found") and the system PATH. On Ubuntu 24.04 that PATH comes from /etc/environment, so /usr/local/bin works but anything installed under your home directory does not. Exit code 127 means the shell could not find the command.
Other solutions
- If the message names your own script and the file is there, look at its first line: a script saved with Windows line endings has an invisible \r after #!/bin/bash, the system looks for an interpreter called "bash\r", and dash reports the script itself as not found. dos2unix or sed -i 's/\r$//' fixes it.
- Variables your script reads (API keys, NODE_ENV) are missing for the same reason. Define them in the crontab or source a file in the command: . /home/you/app/.env.cron && node job.js.
- If the job only calls a URL in your app, the PATH problem goes away when something outside the server makes the request. RunLater calls the URL on your cron schedule, retries failures and keeps each response.
Check a schedule before you deploy it: the cron expression explainer shows the next 10 run times.
Frequently asked questions
Why does my command work in the terminal but not in cron?
Your terminal loads your shell profile, which adds directories such as ~/.nvm, ~/.bun/bin or ~/.local/bin to PATH. cron starts jobs without it, so commands installed there are not found.
What PATH does cron use?
It depends on the system. On Ubuntu 24.04 jobs get the PATH from /etc/environment (/usr/local/sbin through /snap/bin). Directories under your home folder are never included unless you set PATH in the crontab.
Can I use $PATH or ~ in a crontab PATH line?
No. crontab assigns the value as written, without variable or tilde expansion. Write each directory out in full.
What does exit code 127 mean in cron?
The shell could not find the command. It is the exit status behind "not found" and "command not found".
Have the URL called on schedule, with retries
RunLater calls your URL on a cron schedule or at an exact time, in your timezone, retries failed calls with backoff and logs each response, so a timeout or a 5xx shows up in a log instead of disappearing.