npm安装package.json中指定的确切包版本 [英] npm install the exact package version specified in package.json
问题描述
目前,如果我运行 npm install
,它会安装已安装软件包的更新版本。如何安装 package.json
文件中指定的确切版本?
Currently, If I run npm install
, it installs the updated version of already installed packages. How can I install the exact version as specified in the package.json
file?
推荐答案
该行为实际上是由指定package.json中的版本的行为驱动的。如果版本号看起来像1.0.0,没有任何其他符号,则应安装确切的版本(1.0.0)。
That behavior is really driven by the one specifying the versions in the package.json. If the version number looks like "1.0.0", without any other symbols, the exact version (1.0.0) should be installed.
所以你能做的就是只需修改package.json然后运行 npm install
。在执行此操作之前,请务必清除node_modules目录。
So what you could do is simply modify the package.json and run a npm install
then. Be sure to clear out the node_modules directory before you do that.
https://docs.npmjs.com/files/package.json#dependencies
这篇关于npm安装package.json中指定的确切包版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!