Node Program Runs in Terminal, but Not As a “do shell script” AppleScript I have a call (“mercury-parser” via Yarn, using the full path to the call) that converts Web pages to lines of structured text (the page used in the call describes the service):

/Users/me/.yarn/bin/mercury-parser https://postlight.com/trackchanges/mercury-goes-open-source


If I run it in Terminal (using either /bin/bash or /bin/sh on a 2013 Mac Pro, macOS 10.14.5), I get the proper result: fourteen lines of structured text from the Web page.

However, the very same call returns an error when run as a single-line, “do shell script” AppleScript:

do shell script "/Users/me/.yarn/bin/mercury-parser https://postlight.com/trackchanges/mercury-goes-open-source"


The error returned is:

error "env: node: No such file or directory" number 127


FWIW, here are both my .profile and my .bash_profile texts (the latter created solely to try and solve this quandary), that should not be necessary, given that the full path to the call is being specified, specifically to avoid such an error:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

[[ -s $HOME/.nvm/nvm.sh ]] &amp;&amp; . $HOME/.nvm/nvm.sh  # This loads NVM

source ~/.nvm/nvm.sh

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] &amp;&amp; . "$NVM_DIR/nvm.sh" # This loads nvm


What do I have to do to get the call to run as an AppleScript?

[2019.6.26 at 11:25:45PM: Edited in an attempt at clarification.]

2019.6.27 at 1:36:57PM: Per Mark’s suggestion:

Thank you, Mark; I duplicated my .[bash_]profile,  renamed it to “.bashrc”, and added “bin/bash” to the call:

do shell script "bin/bash; /Users/RF/.yarn/bin/mercury-parser https://postlight.com/trackchanges/mercury-goes-open-source"


However, (after a reboot) I still get the same error:

error "env: node: No such file or directory" number 127


Thoughts?
This was solved by KniazidisR at https://macscripter.net/viewtopic.php?pid=196447#p196447

set nodePath to "/usr/local/Cellar/node/12.5.0/bin/node "
set mercuryParserPath to "/usr/local/bin/mercury-parser "
set pageURL to "https://postlight.com/trackchanges/mercury-goes-open-source"

do shell script nodePath &amp; mercuryParserPath &amp; pageURL