npm类似maven,npm可以说是一种前端包管理器
--------------------npm下载依赖的源的设置命令--------------------
//https://www.runoob.com/w3cnote/npm-switch-repo.html //淘宝镜像
npm install npm -g
npm config get registry //查询从哪个源下载包
npm config set registry http://registry.npm.taobao.org //设置源为淘宝镜像
---------------------------npm创建配置文件-------------------
npm init --yes //快速生成npm配置文件(package.json)
npm init //需要写入一些信息,生成npm配置文件(package.json)
如果有package.json配置文件,其他人直接执行npm install就会下载配置文件中的所有的依赖。
--------------------------------npm下载和卸载依赖包-------------------------
npm -v //查看npm版本
npm install 模块名 //npm安装模块
npm install 模块名 -g
npm list -g //查看所有全局安装的模块
npm list 模块名 //查看某个模块的版本号
npm install 模块名@5.5.9 //安装指定版本的模块
npm install -save 模块名 //运行时依赖
npm install -save-dev 模块名 //开发时依赖
npm update 模块名 //更新模块
npm uninstall 模块名 //卸载模块