好像是node的版本太久沒更新了,npm指令整個爛掉。
所以就一直重裝很多次才正常..
系統需求
安裝npm可以透過Mac的套件管理工具homebrew
$ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
安裝完後可以使用doctor來測試brew是否可正常執行
$ brew doctor
Your system is ready to brew.
前情提要 npm
npm is Node's package manager. It is now installed automatically with Node.js so there is no need to do a separate installation.
意思就是npm是一個node.js的套件管理的工具,裝完node.js就會自動安裝好npm了,
不過在Mac下面都是用homebrew這個套件管理工具來安裝node.js
意思就是npm是一個node.js的套件管理的工具,裝完node.js就會自動安裝好npm了,
不過在Mac下面都是用homebrew這個套件管理工具來安裝node.js
移除Node.js
用brew裝的就用brew uninstallbrew uninstall node
一般來說node套件會預設裝在/usr/local/bin,所以請將以下的目錄都要砍掉
rm -rf /usr/local/bin/node
rm -rf /usr/local/bin/npm
rm -rf /usr/local/bin/node_modules
不行的話,就多操作幾次XD..
安裝Node.js
brew install node裝完後打個npm就會噴出以下的資訊
Usage: npm
where is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, repo, restart, rm,
root, run-script, s, se, search, set, show, shrinkwrap,
star, stars, start, stop, submodule, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, version,
view, whoami
npm -h quick help on
npm -l display full usage info
npm faq commonly asked questions
npm help search for help on
npm help npm involved overview
打完收工....
參考資料
http://shapeshed.com/setting-up-nodejs-and-npm-on-mac-osx/
沒有留言:
張貼留言
留個話吧:)