简体   繁体   中英

Why my Nodejs gets automatically upgraded to the latest version of Nodejs after sometime?

I have a previous version of node installed but after few days it gets automatically updated to the latest version. I do not want it to upgrade itself to a newer version.

You need to specify the exact node version in your package.json file.

A bit of background, from the NPM documentation :

It's important to communicate the extent of changes in a new release of code, because sometimes updates can break code that a package needs (called dependencies).Semantic versioning (semver) is a standard that was designed to solve this problem.

  1. From your terminal, type node --version ; you will get a number formatted as XXX
  2. Open your package.json file and remove any ~ or ^ signs from the node version you want to use so that it won't update to any minor or batch changes.
  3. enter npm install in your terminal again and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM