简体   繁体   English

是否可以在不进行npm安装的情况下生成package-lock.json文件?

[英]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.

相关问题 Npm 本地依赖将在任何安装时生成一个新的 package-lock.json - Npm local dependency will generate a new package-lock.json with any install 以编程方式生成 package-lock.json - generate package-lock.json programmatically 如果我更改节点版本并安装 npm ,package-lock.json 中的 package 版本是否更改? - If I change the node version and do npm install, does the package versions in package-lock.json change? npm从package-lock.json文件中创建一个package.json文件? - npm to create a package.json file out of the package-lock.json file? 如果每次运行 npm 安装时它都会更改,那么 package-lock.json 有什么用? - For what use is the package-lock.json if it changes everytime you run npm install? npm install 更改了我的 package-lock.json,这会干扰远程代码吗? - npm install changes my package-lock.json, will that interfere with the remote code? 有没有办法下载 package-lock.json/yarn.lock 文件中的所有依赖项而不安装它们? - Is there a way to download all dependencies in a package-lock.json/yarn.lock file without installing them? 使用package-lock.json的工作流程 - Workflow with package-lock.json 从 package-lock.json 文件重新安装包 - Reinstall package from package-lock.json file 我应该添加 npm-shrinkwrap.json、package-lock.json 还是 yarn.lock? - Should I add npm-shrinkwrap.json, package-lock.json or yarn.lock?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM