npm包管理器使用技巧

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 包名@版本號

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章