“Please try running this command again as Root/Administrator” error when trying to install LESS

后端 未结 11 2071
栀梦
栀梦 2020-12-02 14:09

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 d

11条回答
  •  时光说笑
    2020-12-02 14:51

    I was getting this issue for instaling expo cli and I fixed by just following four steps mentioned in the npm documentation here.

    Problem is some version of npm fail to locate folder for global installations of package. Following these steps we can create or modify the .profile file in Home directory of user and give it a proper PATH there so it works like a charm.

    Try this it helped me and I spent around an hour for this issue. My node version was 6.0

    Steps I follow

    Back up your computer. On the command line, in your home directory, create a directory for global installations:

    mkdir ~/.npm-global

    Configure npm to use the new directory path:

    npm config set prefix '~/.npm-global'

    In your preferred text editor, open or create a ~/.profile file and add this line:

    export PATH=~/.npm-global/bin:$PATH

    On the command line, update your system variables:

    source ~/.profile

    To test your new configuration, install a package globally without using sudo:

    npm install -g jshint

提交回复
热议问题