//换源
npm config set registry https://registry.npm.taobao.org
//配置后通过以下方法验证是否成功
npm config get registry
设置成功后,再次执行create-react-app;
案例:一个博主案例,没找到根本原因,只以为是权限问题,这样的做法也只能解决一时,后面的再运行他也就出错拉
解决方式案例:
运行create-react-app时,如果报错应该有对应提示信息及解决方案:
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 501:20 “/Users/xxxxx/.npm”**
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /Users/xxxxx/.npm/_cacache/index-
npm ERR! errno -13
明显的解决提示,像这样的运行一下**npm ERR! sudo chown -R 501:20 “/Users/xxxxx/.npm”**