简体   繁体   English

如果我在package.json中没有使用插入符号(^)或波浪号(〜),我还需要package-lock.json吗?

[英]Do I still need a package-lock.json if I am not using caret(^) or tilde(~) in my package.json?

If I am always using definite versions of packages inside my package.json, what is the need of package-lock.json. 如果我总是在package.json中使用明确版本的包,那么package-lock.json的需求是什么。 Or other way to put this question is , If someone wants to use package-lock.json, why can't they just use definite versions of packages(1.2.3 and not ^1.2.3) inside package.json. 或者提出这个问题的其他方法是,如果有人想使用package-lock.json,为什么他们不能在package.json中使用明确版本的包(1.2.3而不是^ 1.2.3)。

The use of package-lock.json optimize the installation process because the full dependency tree is already calculated : package-lock.json的使用优化了安装过程,因为已经计算了完整的依赖关系树:

optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages. 通过允许npm跳过以前安装的包的重复元数据解析来优化安装过程。 doc DOC

And as @imjared mentionned, definite versions of package can still have dependencies on caret versions. 正如@imjared所提到的,包的确定版本仍然可以依赖于插入符号版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复 package-lock.json 中未在 package.json 中列出的易受攻击的 npm 包? - How do I fix a vulnerable npm package in my package-lock.json that isn't listed in the package.json? 如何更新 package.json 和 package-lock.json 文件中的所有包? - How can I update all the packages inside the package.json and package-lock.json files? 我是否提交由 npm 5 创建的 package-lock.json 文件? - Do I commit the package-lock.json file created by npm 5? 从 package-lock.json 创建 package.json - Create package.json from package-lock.json 有没有办法从 package-lock.json 中提取 package.json? - Is there a way to extract package.json from package-lock.json? 如何使用 npm 将 package-lock.json 和/或 package.json 中的包版本更新到最新版本? - How to update version of a package in package-lock.json and/or package.json using npm to latest version? 角度应用程序中需要 package.json 和 package-lock.json 文件 - Need for both package.json, package-lock.json files in an angular application 我需要在package.json中添加旧的依赖项吗? - Do I need to add older dependencies in my package.json? Whats difference between package-lock.json and package.json, when is package.json generated? - Whats difference between package-lock.json and package.json, when is package.json generated? package.json 中波浪号 (~) 和插入符 (^) 有什么区别? - What's the difference between tilde(~) and caret(^) in package.json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM