...
Whats weird is I can run homebridge and connect if I manually run it from the terminal.
The only thing I have to go on is this error log: /bin/sh: npm: command not found
...
I'll take a shot at answering this.
Relevant fact #1:
The command runs from a Terminal window.
Relevant fact #2:
The command does NOT run from a launchd job.
Relevant fact #3:
This error message in the launchd job's error log:
/bin/sh: npm: command not found
My guess is that the 'npm' command is not located in a directory that's in the default PATH. As a result, when 'npm' is given as a command in the launchd job's shell script, the command isn't found and the script fails.
The reason it works in a Terminal window is almost certainly that there's a modified profile file (read the man page for bash, and find the word "profile") which alters PATH to include a dir or dirs where npm resides.
To find out where npm resides, paste this into a Terminal window:
If npm is available as a command, i.e. it resides in a dir in the PATH variable, then the output will be the absolute pathname of the 'npm' that was found.
If an absolute path for 'npm' was output, then you basically have two options:
1. Change the unadorned 'npm' commands in your shell script to use the absolute pathname of the npm command that was listed in the Terminal window. In short, specify exactly which 'npm' command to run, rather than relying on PATH dir's being searched.
2. Change the PATH variable to include the dir where 'npm' resides. You can do this at the front of the shell script, before any commands are run but after any initial shebang line. You could also do it by adding an environment variable to your launchd job's plist (google search terms: launchd plist environment variable).
I'll also note that your plist looks a lot different than the one given in the github.com article you referenced. In particular, the github plist sets PATH in the environment, and has a completely different ProgramArguments array.
Can you describe exactly where you got your plist from? A URL would be good, so I can read the context of what it should be doing.