且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 package-lock.json 中 npm 更新依赖项版本?

更新时间:2022-05-10 22:54:26

如果你想更新 package-lock.json 中的版本,你可以通过使用

If you want update version in package-lock.json,you can do it by updating the package using

npm update <package_name>

  • '^' >>大约相当于版本"
  • '~' >>兼容版本"
  • 在 package.json 中阅读更多关于 '^' 和 '~' >> 参考

    Read more about '^' and '~' in your package.json >> Reference

    由于 package-lock 为每个模块及其每个依赖项指定了版本、位置和完整性哈希,因此它创建的安装将是相同的,对于共享项目中的每个用户来说,每次都是相同的.

    As the package-lock specifies a version, location and integrity hash for every module and each of its dependencies, the install it creates will be the same, every single time for each user in shared project.

    你想要的一切了解 package-lock.json

    希望这能帮助您理清思路.

    Hope this will help you clear your thoughts.