1.修改源
npm默認使用國外的源,所以下載包的速度很慢,建議使用國內淘寶源。
執行以下命令即可切換到淘寶源:
npm config set registry https://registry.npm.taobao.org/
如果想換回默認源,可執行以下命令:
npm config set registry https://registry.npmjs.org/
查看當前源的命令:
npm config get registry
2.查看安裝的包
npm list --depth=0 -g
3.查看包的版本
//查看所有版本
npm view 包名 versions
//查看最新版本
npm view 包名 version
4.升級包
//升級到最新
npm update 包名
//升級到指定版本
npm update 包名@版本號