From Lee Driscoll:
When deploying through strong-pm, the npm rebuild phase returns the following error:
Error: node-gyp requires that the user's home directory is specified in either of the environmental variables HOME or USERPROFILE
Googling that message shows people having this problem across various systems and fixing it by setting $HOME explicitly at the start of their script.
Using the .env file doesn't work I believe as that isn't read until the "start" phase