Error: EACCES: permission denied when trying to install ESLint using npm

后端 未结 8 1375
执念已碎
执念已碎 2021-01-29 23:59

I\'m trying to install ESLint with npm by going:

npm install -g eslint

However I get the following error:

Deans-Air:~ deangibso         


        
8条回答
  •  没有蜡笔的小新
    2021-01-30 00:41

    This problem is well documented in the npm docs: Fixing npm permissions.

    You have 2 solutions available:

    Option 1: Change npm's default directory to a hidden directory in your home folder

    mkdir ~/.npm-global
    npm config set prefix '~/.npm-global'
    export PATH=~/.npm-global/bin:$PATH
    source ~/.profile
    

    Option 2: Use a package manager that takes care of this for you

    brew install node
    

提交回复
热议问题