简体   繁体   English

package.Json 团队中不同的包版本

[英]package.Json different packages version in the team

We are facing different packages version among team members depend on when they run npm i or yarn.我们面临团队成员之间不同的软件包版本,这取决于他们何时运行 npm i 或 yarn。 I know the root of the problem is ^ in the version of the package json package list.我知道问题的根源是包json包列表版本中的^

Is it goog idea to use the exact version and ignore the minor updates?使用确切版本并忽略次要更新是否是愚蠢的想法? Is there a better approach?有没有更好的方法?

thank.谢谢。

You need to use package-lock.json file to keep track of the exact version of every package that is installed so that a product is 100% reproducible in the same way even if packages are updated.您需要使用package-lock.json文件来跟踪安装的每个软件包的确切版本,以便即使软件包更新,产品也能以相同的方式 100% 重现。

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json.对于 npm 修改 node_modules 树或 package.json 的任何操作,都会自动生成package-lock.json You need to commit this file in the repostitory after installing/updating a package.安装/更新软件包后,您需要在存储库中提交此文件。

Here are some usefull links to get you started:以下是一些有用的链接,可帮助您入门:

Link1链接1

Link2 链接2

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM