命令:npm install -g npm@latest
结果:
npm ERR! 代码 EACCES npm ERR! 系统调用 rename npm ERR! 路径 /usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width npm ERR! 目标 /usr/local/lib/node_modules/.staging/string-width-fa87d55b npm ERR! 错误码 -13 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! [OperationalError: EACCES: 权限被拒绝,无法重命名 '/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/string-width' -> '/usr/local/lib/node_modules/.staging/string-width-fa87d55b'] { npm ERR! cause: [Error: 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 ERR! code: 'EACCES', npm ERR! syscall: 'rename', 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 ERR! code: 'EACCES', npm ERR! syscall: 'rename', 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! npm ERR! 您的操作系统拒绝了此操作。 npm ERR! 您可能没有当前用户访问该文件的权限 npm ERR! npm ERR! 如果您认为这可能是权限问题,请仔细检查该文件及其包含目录的权限,或尝试以 root/Administrator 身份再次运行命令。
npm ERR! 完整的日志记录可以在以下位置找到: npm ERR! /home/surendra/.npm/_logs/2021-05-06T12_41_30_866Z-debug.log