0

Is it a general rule if we switch git branch often, and after that, we should just use

npm update

instead of

npm install

because npm update will be sufficient? (and that update is a lot faster than install)?

(Switching branch might include upgrading or downgrading a node module).

nonopolarity
  • 146,324
  • 131
  • 460
  • 740

1 Answers1

0

Yes npm update should be sufficient. In the case that someone commits a change to package.json adding dependency x on a branch, if you check out their branch and run npm update, you will have dependency x in your node_modules directory.

See this for more information on why you would want to use update vs install.

klvs
  • 1,074
  • 6
  • 21