Run Node with Cron When You Use nvm
If Node is installed through nvm, cron can't find it — nvm adds Node to your PATH only in interactive shells. The fix is to call the full path to the nvm-managed node binary in your cron line.
Why 'node: command not found'
nvm modifies PATH inside your .bashrc/.nvm for login shells. Cron runs a minimal non-interactive shell that never sources those, so bare node isn't found.
The fix: full path to the nvm node
Find it with which node (or nvm which current):
*/10 * * * * /home/user/.nvm/versions/node/v20.11.0/bin/node /home/user/app/job.js >> /home/user/app/job.log 2>&1
Pin to a version, not 'current'
Use the explicit version path so an nvm use elsewhere doesn't change which Node cron runs. Update it when you upgrade Node.
If the script needs global npm tools
Add the same bin directory to PATH at the top of the crontab: PATH=/home/user/.nvm/versions/node/v20.11.0/bin:/usr/bin:/bin. Then npm-installed CLIs resolve too.
FAQ
Why does cron say 'node: command not found' with nvm?
nvm only sets PATH in interactive shells. Cron's minimal shell doesn't source your profile, so use the full path like /home/user/.nvm/versions/node/vXX/bin/node.
How do I find my nvm node path for cron?
Run 'which node' or 'nvm which current' in your shell and copy the absolute path into the cron line.
Should I use the version path or 'current' for nvm in cron?
Use the explicit version path so a later 'nvm use' doesn't silently change which Node cron runs.