我正在尝试安装React,但出现以下错误,该如何解决?
我正在尝试安装:
npm install -g create-react-app
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/pedro/.npm/_cacache/tmp/09106e29
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1000 "/home/pedro/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pedro/.npm/_logs/2019-10-25T14_14_48_169Z-debug.log
答案 0 :(得分:1)
根据错误日志提供的信息,您只需要授予 npm 程序包管理器在其下运行对文件夹/home/pedro/.npm
的适当权限的用户。
作为信息提供的命令应为:sudo chown -R 1000:1000 "/home/pedro/.npm"