如何仅安装"devDependencies"使用npm [英] How to install only "devDependencies" using npm

查看:482
本文介绍了如何仅安装"devDependencies"使用npm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图仅安装package.json文件中列出的"devDependencies".但是以下命令均无法正常运行.以下所有命令还安装了我不想要的生产依赖项.

I am trying to install ONLY the "devDependencies" listed in my package.json file. But none of the following commands work as I expect. All of the following commands install the production dependencies also which I do not want.

npm install --dev
npm install --only=dev
npm install --only-dev

我想不出任何其他方法告诉npm单独安装devDependencies. :(

I cannot think of any more ways of telling the npm to install the devDependencies alone. :(

推荐答案

检查 NPM文档进行安装:

带有--production标志(或将NODE_ENV环境变量设置为生产)时,npm不会安装devDependencies中列出的模块.

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

--only={prod[uction]|dev[elopment]}参数将导致仅安装devDependencies或仅安装非devDependencies,而与NODE_ENV无关.

The --only={prod[uction]|dev[elopment]} argument will cause either only devDependencies or only non-devDependencies to be installed regardless of the NODE_ENV.

您尝试过以下吗?

npm install --only=dev

这篇关于如何仅安装"devDependencies"使用npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆