我试图在我的mac上全局安装lessc,我从他们的网站上安装了node.js,当我运行命令时(npm install -g less)我得到了这个,请你帮我,我想要的只是做的是安装Less并使sublimetext 3上的less2css编译器正常工作:
npm install -g less
npm WARN locking Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock failed { [Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock' }
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/less, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Mohammad/npm-debug.log
MacBook-Pro:~ Mohammad$ npm install -g less
npm WARN locking Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock failed { [Error: EACCES, open '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/Mohammad/.npm/_locks/less-c2213c903e2e7354.lock' }
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/less, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Mohammad/npm-debug.log
答案 0 :(得分:2)
如果您对/usr/local
目录没有写入权限,则需要以超级用户身份执行此命令。
请尝试:
sudo npm install -g less