NPM笔记

231 阅读1分钟

NPM 笔记

[ 安装 | 更新 | 卸载 ] 依赖包

如何安装全局依赖包

 # 全局命令:
 npm install -g <package>
 # 例如:
 npm install -g lodash
 
 # 本地命令:
 npm install <package>
 # 例如:
 npm install lodash

如何查看可以更新的依赖包

 # 全局命令:
 npm outdated -g --depth=0
 
  # 本地命令:
 npm outdated

如何更新依赖包

 # 全局命令:
 npm update -g <package>
 # 例如:
 npm update -g lodash
 # 更新全部全局依赖包
 npm update -g
 
 # 本地命令:
 npm update <package>
 # 例如:
 npm update lodash
 # 更新全部本地依赖包
 npm update

如何卸载依赖包

 # 全局命令:
 npm uninstall -g <package>
 # 例如:
 npm uninstall -g lodash
 
 # 本地命令:
 npm uninstall <package>
 # 例如:
 npm uninstall lodash