I am currently trying to programmatically run a npx eleventy function through a bash script (on a cronjob)
I have tried it on my terminal, it works perfectly fine, ran a command as such
cd /Users/me/Desktop/test-folder/public && /usr/local/bin/npx eleventy
Also did checked the following
npm -v - 6.14.5
and
npx -v - 6.14.5
running which npm returns /usr/local/bin/npm and
running which npx returns /usr/local/bin/npx
However, running the following commands (below) in the bash script doesn't work...
test.bash
cd /Users/me/Desktop/test-folder/public && /usr/local/bin/npx eleventy
cd /Users/me/Desktop/test-folder/public && /usr/local/bin/npx -v
cd /Users/me/Desktop/test-folder/public && /usr/local/bin/npm -v
throwing the following error: env: node: No such file or directory.
However, it seems that I do have node on running the following command,
cd /Users/me/Desktop/test-folder/public && /usr/local/bin/node -v
returns v12.16.1
Seek some help please!
Edit:
my cronjob
* * * * * bash /Users/me/Desktop/test.bash >> /Users/me/Desktop/testvimbackup.log 2>&1
Output of echo PATH=$PATH 1>&2:
PATH=/usr/bin:/bin