升级npm,npm错误!错误:EACCES:权限被拒绝

升级npm,npm错误!错误:EACCES:权限被拒绝,npm,npm-install,Npm,Npm Install,命令:npm安装-gnpm@latest 结果: npm错误!代码EACCES npm错误!系统调用重命名 npm错误!path/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/字符串宽度 npm错误!dest/usr/local/lib/node_modules/.staging/string-width-fa87d55b npm错误!errno-13 npm错误!错误:EACCES:权限被拒绝,重命名'/usr/lo

命令:npm安装-gnpm@latest

结果:

npm错误!代码EACCES npm错误!系统调用重命名 npm错误!path/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/字符串宽度 npm错误!dest/usr/local/lib/node_modules/.staging/string-width-fa87d55b npm错误!errno-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 ERR!原因:[错误:EACCES:权限被拒绝,重命名'/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string width'->'/usr/local/lib/node_modules/.staging/string-width-fa87d55b']{ npm ERR!errno:-13, npm错误!代码:“EACCES”, npm ERR!系统调用:“重命名”, npm ERR!path:“/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string width”, npm ERR!dest:“/usr/local/lib/node_modules/.staging/string-width-fa87d55b” npm ERR!}, npm ERR!errno:-13, npm错误!代码:“EACCES”, npm ERR!系统调用:“重命名”, npm ERR!path:“/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string width”, npm ERR!dest:“/usr/local/lib/node_modules/.staging/string-width-fa87d55b” npm ERR!} npm错误! npm错误!操作系统拒绝了该操作。 npm错误!您可能没有以当前用户身份访问此文件的权限 npm错误! npm错误!如果您认为这可能是权限问题,请仔细检查 npm错误!文件及其包含目录的权限,或尝试运行 npm错误!以root/Administrator身份再次执行该命令

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