"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"babel-eslint": "^10.0.2",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"compression-webpack-plugin": "^2.0.0",
"cross-env": "^5.1",
"eslint": "^5.16.0",
"eslint-loader": "^2.2.1",
"eslint-plugin-vue": "^5.2.3",
"husky": "^3.0.3",
"laravel-mix": "^4.1.2",
"laravel-mix-eslint": "^0.1.3",
"lint-staged": "^9.2.1",
"resolve-url-loader": "^2.3.1",
"sass-loader": "^7.1.0",
"script-loader": "^0.7.2",
"svg-sprite-loader": "^4.1.3",
"vue-template-compiler": "2.6.10",
"webpack": "^4.39.1",
"webpack-bundle-analyzer": "^3.4.1"
},
"dependencies": {
"camelcase": "^5.3.1",
"clipboard": "^2.0.4",
"core-js": "^3.1.4",
"driver.js": "^0.9.7",
"dropzone": "^5.5.1",
"echarts": "^4.6.0",
"element-ui": "^2.11.1",
"file-saver": "^2.0.1",
"fuse.js": "^3.4.5",
"js-cookie": "^2.2.1",
"jsonlint": "^1.6.3",
"jszip": "^3.2.2",
"node-sass": "^4.12.0",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^3.0.0",
"screenfull": "^4.2.1",
"sortablejs": "^1.8.4",
"tui-editor": "^1.4.5",
"v-charts": "^1.19.0",
"vod-js-sdk-v6": "^1.4.7",
"vue": "2.6.10",
"vue-count-to": "^1.0.13",
"vue-drag-verify": "^1.0.6",
"vue-i18n": "^8.12.0",
"vue-router": "^3.1.2",
"vue-splitpane": "^1.0.4",
"vue-video-player": "^5.0.2",
"vuedraggable": "^2.23.0",
"vuex": "3.1.0",
"xlsx": "^0.14.5"
}
1、devDependencies
(1)内容:是一个对象,配置模块依赖的模块列表,key是模块名称,value是版本范围
(2)作用:该模块中所列举的插件属于开发环境的依赖(比如:测试或者文档框架等)
(3)部署来源:通过你npm install进行依赖安装时加上-save-dev,devDependencies对象中便会增加echarts安装配置,实例安装echarts依赖代码如下
npm install echarts -save-dev
2、dependencies
(1)内容:是一个对象,配置模块依赖的模块列表,key是模块名称,value是版本范围
(2)作用:该模块中所列举的插件属于生产环境的依赖(程序正常运行需要加载的依赖)
(3)部署来源:通过你npm install进行依赖安装时加上-save,dependencies对象中便会增加echarts安装配置,实例安装echarts依赖代码如下
npm install echarts -save
3、安装依赖
(1)如果拿到别人的项目,需要安装之前package.json中devdependencies 和 dependencies两个模块下所列举的依赖,可以通过执行以下命令实现
npm install
(2)如果拿到别人的项目,只需要安装之前package.json中dependencies 模块下所列举的依赖,可以通过执行以下命令实现
npm install packagename
(3)如果拿到别人的项目,只需要安装之前package.json中devdependencies 模块下所列举的依赖,可以通过执行以下命令实现
npm install packagename -dev
4、npm uninstall-删除依赖
(1)npm uninstall "依赖名称":删除依赖,但不会删除package.json的配置(即通过npm install依然可以安装该依赖),删除echarts依赖实例代码如下
npm uninstall echarts
(2)npm uninstall "依赖名称" --save-dev:删除依赖,同时删除package.json中devdependencies 的配置,删除echarts依赖实例代码如下
npm uninstall echarts --save-dev
(3)npm uninstall "依赖名称" --save:删除依赖,同时删除package.json中dependencies 的配置,删除echarts依赖实例代码如下
npm uninstall echarts --save
5、友情提示
(1)编程中,如果自己需要某一依赖,在安装时一定要使用npm install echarts -save或npm install echarts -save-dev,即将依赖配置到package.json中对应的对象中,而非简单使用npm install echarts命令(可以正常安装依赖,但不会配置到package.json文件中),因为如果是协作编程,package.json中没有相关配置,其他协作人员的项目不能正常运行后不能通过npm install正确安装依赖,别人也并不知道你安装了什么依赖,这样就会大大影响协作编程的效率
网友评论