Skip to content

package和package-lock区别 #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Twlig opened this issue Mar 21, 2022 · 0 comments
Open

package和package-lock区别 #61

Twlig opened this issue Mar 21, 2022 · 0 comments
Labels

Comments

@Twlig
Copy link
Owner

Twlig commented Mar 21, 2022

package和package-lock区别

package.json: 主要用来定义项目中需要依赖的包

package-lock.json: 在 npm install时候生成一份文件,用以记录当前状态下实际安装的各个npm package的具体来源和版本号

'^' : 放在版本号之前,表示向后兼容依赖,说白了就是在大版本号不变的情况下,下载最新版的包

项目中引入的包版本号之前经常会加^号,每次在执行npm install之后,下载的包都会发生变化,为了系统的稳定性考虑,每次执行完npm install之后会对应生成package-lock文件,该文件记录了上一次安装的具体的版本号,相当于是提供了一个参考,在出现版本兼容性问题的时候,就可以参考这个文件来修改版本号即可。

@Twlig Twlig added the webpack label Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant