本文介绍了“请尝试再次以Root/Administrator身份运行此命令"尝试安装LESS时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在机器上安装LESS,并且已经安装了节点.但是,当我输入"node install -g less"时,出现以下错误,并且不确定该怎么办?

I'm trying to install LESS on my machine and have installed node already. However, when I enter "node install -g less" I get the following error and am not sure what to do?

FPaulMAC:bin paul$ npm install -g less
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/less'
npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/less']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/less' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! cwd /usr/local/bin
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/less
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/less'
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/less'
npm ERR! error rolling back  { [Error: EACCES, unlink '/usr/local/lib/node_modules/less']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/less' }
npm ERR! not ok code 0

推荐答案

重新爆炸药安装可以运行任意脚本,而使用sudo运行它可能非常危险!"

Re Explosion Pills "An installation can run arbitrary scripts and running it with sudo can be extremely dangerous!"

似乎使用sudo是错误的方法.

Seems like using sudo is the wrong way of doing it.

将/usr/local文件夹中文件的所有者更改为当前用户:"

"Change the owner of the files in your /usr/local folder to the current user:"

sudo chown -R $USER /usr/local

然后运行安装

node install -g less

退房:

  • npm throws error without sudo
  • https://aralbalkan.com/scribbles/npm-install-g-please-try-running-this-command-again-as-root-administrator/
  • http://foohack.com/2010/08/intro-to-npm/#what_no_sudo

这篇关于“请尝试再次以Root/Administrator身份运行此命令"尝试安装LESS时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 15:48