The error you’re getting is because a bash script (yarn) is being executed with node…
Because pm2’s default interpreter is set to node.
To run yarn you’ll have to set the interpreter to bash:
shell:
Try the command below:
pm2 start yarn --interpreter bash --name api -- start