【问题标题】:Upgrading npm, npm ERR! Error: EACCES: permission denied升级 npm,npm ERR!错误:EACCES:权限被拒绝
【发布时间】:2021-07-28 18:58:27
【问题描述】:

命令:npm install -g npm@latest

结果:

npm 错误!代码 EACCES npm 错误!系统调用重命名 npm 错误!路径 /usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width npm 错误! dest /usr/local/lib/node_modules/.staging/string-width-fa87d55b npm 错误!错误号 -13 npm 错误!错误:EACCES:权限被拒绝,重命名 '/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width' -> '/usr/local/lib/node_modules/.staging/string-width- fa87d55b' npm 错误! [操作错误:EACCES:权限被拒绝,重命名'/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width'->'/usr/local/lib/node_modules/.staging/string-width -fa87d55b'] { npm 错误!原因:[错误:EACCES:权限被拒绝,重命名 '/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width' -> '/usr/local/lib/node_modules/.staging/string -width-fa87d55b'] { npm 错误!错误号:-13, npm 错误!代码:'EACCES', npm 错误!系统调用:'重命名', npm 错误!路径:'/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width', npm 错误!目标:'/usr/local/lib/node_modules/.staging/string-width-fa87d55b' npm 错误! }, npm 错误!错误号:-13, npm 错误!代码:'EACCES', npm 错误!系统调用:'重命名', npm 错误!路径:'/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width', npm 错误!目标:'/usr/local/lib/node_modules/.staging/string-width-fa87d55b' npm 错误! } npm 错误! npm 错误!该操作被您的操作系统拒绝。 npm 错误!您可能没有以当前用户身份访问此文件的权限 npm 错误! npm 错误!如果您认为这可能是权限问题,请仔细检查 npm 错误!文件及其包含目录的权限,或尝试运行 npm 错误!再次以 root/管理员身份执行该命令。

npm 错误!可以在以下位置找到此运行的完整日志: npm 错误! /home/surendra/.npm/_logs/2021-05-06T12_41_30_866Z-debug.log

【问题讨论】:

    标签: npm npm-install


    【解决方案1】:
    run npm package as administrator by using command 
    sudo npm install -g npm@latest
    '''
    

    【讨论】:

      猜你喜欢
      • 2020-03-06
      • 2021-07-22
      • 1970-01-01
      • 2019-10-28
      • 2017-12-29
      • 2018-03-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-24
      相关资源
      最近更新 更多