喺 Yosemite 安裝 npm

冇咩特別啫,咁都要講?

係囉,不過新手嘛,講下會清楚啲,又唔會花幾多時間!

npm 係乜?去官網睇下:

Screen Shot 2015-09-09 at 7.39.36 am

中間嘅紅色字會不停咁轉,不時出現一啲你識嘅,或者唔識嘅,又或者打算用嘅 library 名,到最後停咗喺 JavaScript。冇錯,npm 就係會幫你下載同埋安裝哩啲 JavaScript Library 嘅 command line 工具。

npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you’re sharing.

唔係老作,佢自稱咖:

Screen Shot 2015-09-09 at 7.27.58 am

未安裝之前,我哋嚟確認一下部機有冇 npm,打開 Terminal,輸入 npm 同埋 node,應該出現以下嘅畫面:

Screen Shot 2015-09-09 at 7.05.31 am

Yosemite 唔知你講咩,所以,係正常嘅。咁我哋開始安裝!首先去 nodejs.org,下載同埋安裝 node.js:

Screen Shot 2015-09-09 at 7.05.59 am

掂解係 node.js 而唔係 npm?係囉,因為一次安裝,除咗有 node.js 仲有埋 npm,送嘅!嗰網站好 smart,會知道你用 OS X,自動攞隻啱嘅 installer 俾你,跟住嘅步䠫全自動,你跟住個畫面 click 就得,不過我都有 screen cap 俾你參考:

Screen Shot 2015-09-09 at 7.07.03 am

Screen Shot 2015-09-09 at 7.07.32 am

Screen Shot 2015-09-09 at 7.07.55 am

Screen Shot 2015-09-09 at 7.08.07 am

Screen Shot 2015-09-09 at 7.08.20 am

Screen Shot 2015-09-09 at 7.08.44 am

Screen Shot 2015-09-09 at 7.08.59 am

再喺 Terminal 測試,今回會有 version number,咁就大功告成!

Screen Shot 2015-09-09 at 7.25.54 am

P.S. 順便裝埋 Bower,Bower 同 npm 係差不多功能嘅嘢,日後寫 program 多數都會用到:

Screen Shot 2015-09-10 at 7.42.02 am

一句安裝:

sudo npm install -g bower

就係咁簡單:

Screen Shot 2015-09-10 at 7.59.11 am

嘿嘿!個畫面有啲唔同咗?係呀,用咗 iTerm,比較好用,你都去下載嚟用啦(www.iterm2.com)!