2015-03-31 45 views
1

對於API密鑰,我想使用智能密鑰鎖定。但我不能安裝水鎖。該錯誤消息顯示在下方。無法鎖定安裝

npm WARN locking Error: EACCES, open '/home/developer/.npm/_locks/waterlock-96592128476e35c7.lock' 
npm WARN locking  at Error (native) 
npm WARN locking /home/developer/.npm/_locks/waterlock-96592128476e35c7.lock failed { [Error: EACCES, open '/home/developer/.npm/_locks/waterlock-96592128476e35c7.lock'] 
npm WARN locking errno: -13, 
npm WARN locking code: 'EACCES', 
npm WARN locking path: '/home/developer/.npm/_locks/waterlock-96592128476e35c7.lock' } 
npm ERR! Linux 3.13.0-34-generic 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "waterlock" 
npm ERR! node v0.12.1 
npm ERR! npm v2.5.1 

npm ERR! Attempt to unlock /home/developer/Desktop/Sails/AuthTest/node_modules/waterlock, which hasn't been locked 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <http://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  /home/developer/Desktop/Sails/AuthTest/npm-debug.log 
+0

你有寫'/ home/developer/.npm'的權限嗎? – 2015-03-31 09:00:03

+0

我是一位新的Ubuntu用戶。我已經安裝了npm看官方文檔。我不確定這一點。 – 2015-03-31 09:01:40

+0

'sudo chown -R $(whoami)$ HOME/.npm'會將您設置爲您的npm模塊文件夾的所有者。嘗試一下,然後重試'npm install waterlock'。 – 2015-03-31 09:07:09

回答

3

通常,當你得到EACCES錯誤,一個好的開始是看你是否有寫權限到npm正在寫入的文件夾(你會在你的錯誤,在這種情況下,/home/developer/.npm)。

你可以看到,如果你通過運行

ls -l /home/developer/.npm 

有寫入權限,如果你看到這樣

drwxr-xr-x 2 SOMEONE-ELSE SOMETHING-ELSE 4.0K Mar 26 16:43 bin 

而不是

drwxr-xr-x 2 developer developer 4.0K Mar 26 16:43 bin 

這意味着你的用戶不擁有該目錄,因此您可能需要運行

sudo chown -R $(whoami) $HOME/.npm 

獲得這些權利。