无法安装 Waterlock

Can not Waterlock installation

对于 API 密钥,我想通过水锁来使用 JWT。但我无法安装水锁。错误消息显示如下。

 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

通常当你得到 EACCES 错误时,一个好的开始是查看你是否对 npm 正在写入的文件夹具有写入权限(你在错误中得到了它,在这种情况下它是/home/developer/.npm).

你可以通过运行ning

查看你是否有写权限
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

获得这些权利。