NPM 安装单个包,没有其他依赖项 [英] NPM install single package without rest of dependencies

查看:91
本文介绍了NPM 安装单个包,没有其他依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 npm 中,我如何安装没有列表中其余依赖项的单个包,因为如果我安装依赖项,例如npm i express 所有其他依赖项也被安装.我如何防止这种情况并且只安装了 express

In npm, how do i install a single package without the rest of the dependencies in the list, because if i install on dependency e.g. npm i express all other dependencies get installed as well. How do i prevent this and have only express installed

编辑另一个问题有一个非常复杂的创建 bash 文件的答案,我不愿意走那么远,我想要一个更简单的答案

EDIT The other question has a very complicated answer of creating a bash file, am not willing to go that far, i want a simpler answer

推荐答案

为了避免安装可选的依赖项,你可以使用选项:--no-optional 根据这个链接支持它文档 :

To avoid installing optional dependencies, you could use the option: --no-optional it is supported according to this link of the docs :

--no-optional 参数将阻止安装可选的依赖项.

此外,有些依赖项不是可选的,您无法阻止它们的安装,因为包具有直接依赖项.

Also, there are dependencies which are not optional, you can't stop them from being installed since the package has a direct dependency.

这篇关于NPM 安装单个包,没有其他依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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