gpt4 book ai didi

node.js - package-lock.json 是否需要在 git 中进行版本控制?

转载 作者:太空宇宙 更新时间:2023-11-03 22:41:11 26 4
gpt4 key购买 nike

npm 5&nodejs 8引入了一个名为package-lock.json的文件,我想知道它是否需要版本控制或在git中被忽略

最佳答案

简短回答:是的,一定是。

长答案:

根据npmjs Documentaion :

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.

This file is intended to be committed into source repositories, and serves various purposes:

  • Describe a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies.

  • Provide a facility for users to time-travel to previous states of npm_modules without having to commit the directory itself.

  • To facilitate greater visibility of tree changes through readable source control diffs.

  • And optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages.

关于node.js - package-lock.json 是否需要在 git 中进行版本控制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44646719/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com