[英]Is it possible to generate just a package-lock.json file without doing an npm install?
I need to generate just a package-lock.json file, but I don't want to rerun npm install. 我只需生成一个package-lock.json文件,但我不想重新运行npm install。
Is it possible just to generate this lock file without it reinstalling any of my package files? 是否可以生成此锁文件而不重新安装任何我的包文件?
You can use the --package-lock-only
argument: 您可以使用
--package-lock-only
参数:
npm install --package-lock-only
See the documentation : 查看文档 :
The --package-lock-only argument will only update the package-lock.json , instead of checking node_modules and downloading dependencies.
--package-lock-only参数只会更新package-lock.json ,而不是检查node_modules和下载依赖项。
You can use npm shrinkwrap
and rename the file afterward. 您可以使用
npm shrinkwrap
并在之后重命名该文件。 source 资源
Depending on what you are trying to achieve, renaming may be useless as package-locks doc : 根据您要实现的目标,重命名可能与package-locks doc一样无用:
npm uses package-lock.json or, if present, npm-shrinkwrap.json
npm使用package-lock.json,如果存在,则使用npm-shrinkwrap.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.