NPM issue deploying a nodejs instance using AWS codedeploy

As accurately noted in the comments by mbaird and Chris - it was that I didn't have my PATH set. So npm, and node, and pm2 and... all failed.

Through experimentation, it appeared I needed to reestablish my path with every step of the Codedeploy deploy process. So at the top of my stop.sh/beforeinstall.sh/afterinstall.sh/start.sh, I included:

source /home/ec2-user/.bash_profile

and life was good. I then ran into other issues with pm2 not starting node in the right working directory, but similar tweaking to the codedeploy scripts got that working.

This was all obvious in hindsight, but I'm extremely grateful for the help. Thank you guys!