[英]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. 您需要在
package.json
文件中指定确切的节点版本。
A bit of background, from the NPM documentation : NPM文档提供了一些背景知识:
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.
在新版本的代码中传达更改的范围很重要 , 因为有时更新可能会破坏程序包所需的代码 (称为依赖项)。语义版本控制(Semver)是旨在解决此问题的标准。
node --version
; node --version
; you will get a number formatted as XXX 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. package.json
文件,并从要使用的节点版本中删除任何~
或^
符号,以使其不会更新为任何次要或批量更改。 npm install
in your terminal again and you are done. npm install
,您就完成了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.