4

I am trying to run an AppleScript that runs a node command like I would run it in terminal and appear to have the right start with the code, but I'm getting hung up on Automator not recognizing the node command sh: node: command not found. Can anyone point me to the reason why automator can't locate node (node command as in Node.js. Node.js is installed on my machine)?

Here is my AppleScript:

do shell script "cd /Users/user/Desktop/Projects/node/cli && node app.js DesktopUSA"
  • Is node installed as part of Node.js? – JMY1000 Feb 15 '17 at 19:44
  • @JMY1000 yes, that is correct it is for Node.js – cphill Feb 15 '17 at 20:41
3

The PATH variable for your AppleScript doesn't contain /usr/local/bin! You can check this with do shell script "env >> $HOME/Desktop/env.txt".

So either configure an additional path or use the full path to node:

do shell script "cd /Users/user/Desktop/Projects/node/cli && /usr/local/bin/node app.js DesktopUSA"
  • Thank you so much for your answer. I felt like it had to do something with telling the script where to find and access node. – cphill Feb 16 '17 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .