Windows 下安裝NPM

第一步: 下載node.js的windows版

 當前最新版本是https://nodejs.org/dist/

 

第二步:設置環境變量

把node.exe所在目錄加入到PATH環境變量中。
配置成功後能夠在CMD中經過node --version 看到node.js對應的版本號
C:\Users\fn>node --version
v6.10.2

第三步: 安裝git

直接到如下地址 https://git-scm.com/download/win 下載Git windows安裝文,按照提示一步步安裝便可。node

安裝完成後把git安裝bin目錄加入PATH環境變量git

找到git安裝路徑中bin的位置,如:D:\Program Files\Git\bingithub

找到git安裝路徑中git-core的位置,如:D:\Program Files\Git\libexec\git-core;express

CMD中運行 git --version 確認安裝是否成功npm

C:\Users\fn>git --version
git version 1.7.7.msysgit.1
windows

第四步: 安裝 npm

在確保node.exe和git都在PATH環境變量中後執行如下命令:服務器

git config --system http.sslcainfo /bin/curl-ca-bundle.crt
git clone --recursive git://github.com/isaacs/npm.git

 

cd npm
node cli.js install npm -gf

下面來測試一下是否成功,一切OK開始Node.JS之旅app

D:\develop\nodejs\hello>npm install -d
npm info it worked if it ends with ok
npm info using npm@1.0.103
npm info using node@v0.5.10
npm info preinstall application-name@0.0.1
npm info addNamed [ 'jade', '>= 0.0.1' ]
npm info addNamed [ 'express', '2.5.0' ]
curl


最好設置下國內鏡像要否則下載會很慢測試

github npm 撞牆的解決方案。 

github: 
代理服務器是必須的,我用的是本地的astrill 
給curl設置代理 
export http_proxy="127.0.0.1:3213" 
export https_proxy="127.0.0.1:3213" 
ok了 

npm: 
設置國內鏡像 npm config set registry http://registry.npmjs.vitecho.com

相關文章
相關標籤/搜索