標籤:lis lin undle 最新版 port 下載 label ast dna
Windows 下安裝NPM 標籤: windowsnode.jsgitexpresspathcmd 2011-11-05 13:18 36528人閱讀 評論(8) 收藏 舉報 本文章已收錄於: 分類:RIA
(139) 作者同類文章
X
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
Node.js停火各大技術論壇都在討論,前段時間工作太忙沒時間學習,趁著周末空閑玩玩,在網上找了些資料發現Node.js本身有windows版和unix版下載和使用都挺方便但是其擴充模組依賴複雜通過手動到網站上下載非常麻煩,所以的NPM介紹都要求在Linux或在windows上通過Cygwin進行安裝,按照網上的辦法下載Cygwin安裝node.js死活不成功(執行./configure 報cygwin not supported)多次嘗試無果,網上又無人解答,在精神處在崩潰邊境無意中點開了NPM的說明文檔,竟然有一節是說明如何在windows下安裝NPM,按照其說明執行終於成功在windows 下安裝了NPM。用起來還是很爽的就是下載檔案慢了點。
第一步: 下載node.js的windows版當前最新版本是http://nodejs.org/dist/v0.5.10/node.exe 第二步:設定環境變數把node.exe所在目錄加入到PATH環境變數中。配置成功後可以在CMD中通過node --version 看到node.js對應的版本號碼C:\Users\fn>node --version
v0.5.10 第三步: 安裝git
直接到以下地址(http://code.google.com/p/msysgit/downloads/list)下載git windows安裝文,目前最新版是Git-1.7.7-preview20111014.exe,按照提示一步步安裝即可。安裝完成後把git安裝bin目錄加入PATH環境變數
CMD中運行 git --version
確認安裝是否成功
C:\Users\fn>git --version
git version 1.7.7.msysgit.1
第四步: 安裝 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之旅
D:\develop\nodejs\hello>npm install -d
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
npm info addNamed [ ‘jade‘, ‘>= 0.0.1‘ ]
npm info addNamed [ ‘express‘, ‘2.5.0‘ ]
最好設定下國內鏡像要不然下載會很慢
github npm 撞牆的解決方案。
github:
Proxy 伺服器是必須的,我用的是本地的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
Windows 下安裝NPM