Search code examples
node.jsnvm

Is it required to `npm install` every time I change the default Node version used?


I often switch between different Node projects in my CLI but I don't know if it is required or not to run npm install after changing Node version. For example I have used Node v8 for one project and decided to changed to v10 using nvm use v10. Do I have to run npm install at that point ?


Solution

  • Your question is valid, because npm install is time consuming command and downloads lots of data as well.

    It is not necessary but dependencies, requirements as well as version of dependencies changes on every node version, so to keep everything up-to-date you need to run npm install so that if there is any change then your modules get updated, and to avoid modules error.