本文介绍了如何仅安装"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文档进行安装:

--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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:24