我目前有node.js版本0.8.8和npm 1.1.59安裝。npm不會安裝快遞?
每當我跑:
$ npm install -g express
我得到這樣的回報:
npm ERR! Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock'
npm ERR! { [Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/devinandrews/.npm/64a534c1-express.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "express"
npm ERR! cwd /Users/devinandrews
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.59
npm ERR! path /Users/devinandrews/.npm/64a534c1-express.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/devinandrews/.npm/64a534c1-express.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/devinandrews/npm-debug.log
npm ERR! not ok code 0
我拉我的頭髮現在試圖弄清楚這一點。
更新:
我跑
$ npm -g ls
看到已在全球安裝了我什麼NPM:
/usr/local/lib
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]0
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
,但如果我運行:
$ npm ls
返回空?
你運行它作爲一個管理員?檢查有問題的鎖文件,看它是否不屬於與您運行的用戶不同的某個用戶 - 我想不出它會是什麼原因,但錯誤表明您沒有權限打開該文件文件,應由您的用戶擁有。 – lanzz
我甚至沒有在我的用戶/ devinandrews目錄中看到.npm文件夾。我可以通過使用sudo npm install -g express來安裝它,但建議我不這樣做。 – Devin
你在尋找shell或Finder中的'.npm'文件夾嗎?您可能在Finder中隱藏了點名(因爲它是默認值);請注意,我假設你在OSX上根據你的主目錄位置來判斷。 – lanzz