[英]Is there a way of making "npm ci" install devDependencies, or "npm install" not update package-lock.json?
I'm trying to put together documentation for new developers installing our codebase on their local development environments.我正在尝试为新开发人员在他们的本地开发环境中安装我们的代码库整理文档。 I'd like to give them command(s) that:
我想给他们命令:
"npm ci" does almost exactly what I want, but doesn't seem to install devDependencies. “npm ci”几乎完全符合我的要求,但似乎没有安装 devDependencies。 "npm install" does install devDependencies, but it sometimes modifies package-lock.json.
“npm install”确实会安装 devDependencies,但它有时会修改 package-lock.json。
I could imagine something janky like "npm install && git checkout package-lock.json", but I feel like there must be a more idiomatic way of saying "give me a clean install of this project's dependencies for development?"我可以想象像“npm install && git checkout package-lock.json”之类的东西,但我觉得必须有一种更惯用的方式来表达“给我一个干净安装这个项目的开发依赖项?”
npm ci
does install both dependecies and dev dependencies. npm ci
确实安装了依赖项和开发依赖项。 But if you use npm ci --production
or if your NODE_ENV
is set to production, then it avoids installing dev dependencies.但是如果你使用
npm ci --production
或者如果你的NODE_ENV
设置为生产,那么它避免安装开发依赖项。 Please check docs here .请在此处查看文档。
With the
--production
flag (or when theNODE_ENV
environment variable is set to production), npm will not install modules listed in devDependencies.使用
--production
标志(或当NODE_ENV
环境变量设置为生产时),npm 将不会安装 devDependencies 中列出的模块。NOTE: The
--production
flag has no particular meaning when adding a dependency to a project.注意:在向项目添加依赖项时,--
--production
标志没有特殊意义。
NODE_ENV
variableNODE_ENV
变量When your NODE_ENV
environment variable is set to production , using npm ci
will not install devDependencies.当您的
NODE_ENV
环境变量设置为production 时,使用npm ci
将不会安装 devDependencies。 But if you still want to install devDependencies但是如果你还想安装devDependencies
npm ci --include=dev
will do the trick ;)会做的伎俩;)
npm ci --also=dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.