node.js 使用----相關經常使用命令總結
1. 下載並安裝node.js
2. 設置全局模塊存放的目錄
2.1 查看默認配置
npm config ls
2.2 修改全局模塊存放目錄
npm config set prefix "e:\\stores\\nodejs\\node_modules\\node_global"
npm config set cache "e:\\stores\\nodejs\\node_modules\\node_global"
2.2.1 修改prefix 後須要在環境變量中添加:
"e:\\stores\\nodejs\\node_modules\\node_global"
3. 安裝工具 nrm (全局安裝)
npm install nrm -g
3.1 使用 nrm 更換鏡像地址
nrm ls //查看有哪些
nrm use taobao //使用淘寶提供的鏡像地址
- nrm 僅僅是提供了幾個經常使用的包地址,用 nrm use XX 來選擇使用的地址
4 npm 查看包信息
4.1 查看遠程包信息
- 方法一
npm info xx
- 方法二
nom view xx versions
4.2 查看本地包信息
npm ls xxx //本地包
npm ls xxx -g //全局包