npm 安装 package.json 中指定的确切包版本 [英] npm install the exact package version specified in package.json

查看:52
本文介绍了npm 安装 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆