1谨读、進(jìn)入nodejs官方網(wǎng)站下載軟件(nodejs.org),
2、下載完成后晤锹,雙擊默認(rèn)安裝摩幔。安裝程序會(huì)自動(dòng)添加環(huán)境變量
3、檢測(cè)nodejs是否安裝成功鞭铆。打開(kāi)cmd命令行 輸入 node - v 顯示當(dāng)前版本號(hào)
4或衡、檢查npm是否安裝。由于新版的NodeJS已經(jīng)集成了npm车遂,所以之前npm也一并安裝好了封断。同樣可以使用cmd命令行中鍵入 npm -v
5、在一個(gè)目錄下舶担,例如D:\node\ 下建立幾個(gè)子目錄:
mkdir npm-global //存放node全局模塊
mkdir npm-cache //npm緩存路徑
6坡疼、配置全局模塊的安裝路徑到node-global文件夾,npm緩存到npm-cache文件夾
npm config set prefix "D:\node\node-global"
npm config set cache "D:\node\node-cache"
7衣陶、把D:\node\node-global加到系統(tǒng)PATH里面柄瑰,方面直接運(yùn)行使用!剪况!
8教沾、驗(yàn)證下吧,裝個(gè)全局模塊:
npm install express -g
查看下node-global和node-cache文件夾下是否有驚喜拯欧,嘿嘿~
chh說(shuō)原來(lái),最新express4.0版本中將命令工具分家出來(lái)了(項(xiàng)目地址:https://github.com/expressjs/generator),所以我們還需要安裝一個(gè)命令工具,命令如下:
npm install -g express-generator
這樣后,在命令行就可以直接輸入express來(lái)驗(yàn)證
驗(yàn)證express
8.1 安裝bower, npm install bower -g; -g表示全局
輸入 node财骨,
require('bower') 顯示如下表示 安裝成功镐作!
那就不檢查了,好像不裝在全局隆箩,裝在項(xiàng)目目錄下是可以用的```
###chh 說(shuō)bower是包管理器该贾,不用require
這樣后,在命令行就可以直接輸入bower來(lái)驗(yàn)證
![驗(yàn)證bower](http://upload-images.jianshu.io/upload_images/2066586-26d39e286842f493.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#卸載node
Uninstall from Programs & Features with the uninstaller.
Reboot (or you probably can get away with killing all node-related processes from Task Manager).
Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
```C:\Program Files (x86)\Nodejs```
C:\Program Files\Nodejs
```C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)```
```C:\Users\{User}\AppData\Roaming\npm-cache(or %appdata%\npm-cache)```
[Check your %PATH% environment variable](http://stackoverflow.com/questions/141344/how-to-check-if-directory-exists-in-path) to ensure no references to Nodejs or npm exist.
If it's *still* not uninstalled, type where node at the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.
Reboot, for good measure.