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

后端 未结 8 1114
执念已碎
执念已碎 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:36

    Use --unsafe-perm=true and --allow-root flags with npm install like below:-

    sudo npm install -g eslint --unsafe-perm=true --allow-root
    

    it worked like charm for me.

    0 讨论(0)
  • 2021-01-30 00:39

    Use sudo before tns and it is work for me

    Example:

    sudo tns create Tekmo --template tns-template-hello-world
    

    if I have used sudo then not found error like to create postinstall.js

    Error: EACCES: permission denied

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2021-01-30 00:44

    Running the following command solved the issue for me while installing my packages.json :

     sudo npm install --unsafe-perm=true --allow-root
    

    To install only the package which caused the issue:

      sudo npm install -g --unsafe-perm=true --allow-root eslint
    
    0 讨论(0)
  • 2021-01-30 00:48
    sudo npm install -g --unsafe-perm=true eslint
    

    is sufficient.

    0 讨论(0)
  • 2021-01-30 00:49

    For MAC user provide the access permission to project directory folder

    1. Right click on project directory folder
    2. Select get info
    3. Provide the access permission - Apply to inclosed items
    0 讨论(0)
提交回复
热议问题