Many distinctions have already been mentioned. Here is one more:
Running npm install
at the top of your source directory will run various scripts: prepublish
, preinstall
, install
, postinstall
. Depending on what these scripts do, a npm install
may do considerably more work than just installing dependencies.
I've just had a use case where prepublish
would call make
and the Makefile
was designed to fetch dependencies if the package.json
got updated. Calling npm install
from within the Makefile
would have lead to an infinite recursion, while calling npm update
worked just fine, installing all dependencies so that the build could proceed even if make
was called directly.