如何仅安装"devDependencies"使用npm [英] How to install only "devDependencies" using 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 theNODE_ENV
environment variable is set to production), npm will not install modules listed indevDependencies
.
--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屋!