Error: EACCES: permission denied

后端 未结 23 2216
醉梦人生
醉梦人生 2020-11-29 19:04

I run npm install lodash but it throws Error: EACCES: permission denied error. I know it is permission issue but as far as I know, sudo permission

相关标签:
23条回答
  • 2020-11-29 19:51

    we need to give write permissions to that folder using:

    sudo chmod 777 path-to-directory

    path-to-directory in this project was (/home/ubuntu/blog/server)

    0 讨论(0)
  • 2020-11-29 19:53

    This solved my issue straight away - mac Mojave 10.14.6 - PhpStorm.

    Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/myname/.npm/_cacache/index-v5/fb/5a'

    sudo chown -R $USER:$GROUP ~/.npm
    sudo chown -R $USER:$GROUP ~/.config
    

    Original post: https://stackoverflow.com/a/50639828

    0 讨论(0)
  • 2020-11-29 19:53

    FWIW I had the same symptoms, but with a different package. Creating package.json and running npm init did NOT solve my issue.

    On this system, apparently new folders in this location were being created with root permissions. During npm install, new folders are created. This caused npm install to fail partway, even with sudo.

    The solution was to run npm install app in a different location with no root umask.

    0 讨论(0)
  • 2020-11-29 19:53

    Here's the solution for GNU/Linux (Debian) users (Replace USERNAME with your username):

    sudo chown -R $USER:$(id -gn $USER) /home/USERNAME/.config
    
    
    0 讨论(0)
  • 2020-11-29 19:54

    If you getting an error like below

    Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/<PackageName>/vendor'
    

    I suggest using the below command to install your global package

    sudo npm install -g <PackageName> --unsafe-perm=true --allow-root
    
    0 讨论(0)
  • 2020-11-29 19:56

    Remove dist folder and this solve my problem!!

    0 讨论(0)
提交回复
热议问题