yarn
// 全局安装木块
yarn global add xxxx
// 卸载包
yarn remove xxxx
cnpm install -g xxxx
npm
npm uninstall -g 包名 //卸载全局包
npm -g install 包名 # 全局安装
npm install # 根据package.json文件安装
npm install 包名 # 本地安装,在npm运行目录下安装
npm install 包名@1.x # 安装指定版本
npm -g update 包名 # 全局更新
npm update 包名 # 本地更新
npm config get prefix // 获取NPM安装目录
npm 发布
npm adduser //添加用户:
npm login //登录
npm login //发布
//在本地安装好的模块中,运行(添加本地模块到全局链接):
npm link
//在要使用的本地目录中,运行(从全局中获取链接):
npm link 模块名