npm install xx --save-dev
安装的是只有
在开发环境下需要用到的xx,
会把依赖包名称添加到 package.json 文件 devDependencies键下
npm install xx --save
安装的是 发布环境中 需要用到的xx,会把依赖包名称添加到 package.json 文件 dependencies 键下
扩展:
正常使用npm install时,会下载dependencies和devDependencies中的模块,当使用npm install –production或者注明NODE_ENV变量值为production时,只会下载dependencies中的模块。