npm commain in Automator
That's because when you run shell command from Automator, it's PATH variable does have all the paths as when you run from Terminal. Use full path to npm executable. You can find the full path with which npm in the Terminal.