npm的dependencies与devDependencies
dependencies与devDependencies的区别
-
devDependencies(development dependencies开发依赖)用于本地环境开发时候。
-
dependencies 用于实际生产环境
简单说,在开发过程中引入的包,部分是为了我们开发需要的工具包,部分是项目中需要使用的插件.工具包我们只需要在开发环境下使用.
为什么npm不下载devDependencies中的包
运行npm config list
命令查看当前npm的production是否为false,即当前是不是生产模式
如果production为true,运行命令npm config set production false
设置为开发模式,在运行npm install
就可以下载devDependencies中的包了
不想下载devDependencies的命令
npm install --production
这个命令不会改变npm config中的production