本文共 1129 字,大约阅读时间需要 3 分钟。
npm删除依赖项
When you install an npm package using npm install <package-name>
, you are installing it as a dependency.
使用npm install <package-name>
安装npm软件包时,将其作为依赖项进行安装。
The package is automatically listed in the , under the dependencies
list (as of npm 5: before you had to manually specify --save
).
该软件包会自动在的dependencies
列表下列出(从npm 5开始:必须手动指定--save
)。
When you add the -D
flag, or --save-dev
, you are installing it as a development dependency, which adds it to the devDependencies
list.
当添加-D
标志或--save-dev
,您会将其安装为开发依赖项,并将其添加到devDependencies
列表中。
Development dependencies are intended as development-only packages, that are unneeded in production. For example testing packages, or .
开发依赖关系旨在作为仅开发包,在生产中不需要。 例如测试包, 或 。
When you go in production, if you type npm install
and the folder contains a package.json
file, they are installed, as npm assumes this is a development deploy.
在生产中,如果键入npm install
且该文件夹包含package.json
文件,则将安装它们,因为npm假定这是开发部署。
You need to set the --production
flag (npm install --production
) to avoid installing those development dependencies.
您需要设置--production
标志( npm install --production
)以避免安装那些开发依赖项。
翻译自:
npm删除依赖项
转载地址:http://weqgb.baihongyu.com/