I'm trying to start create react app but I get this message from npm, please somebody help!
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/fabiodiceglie/.npm/_cacache/content-v2/sha1/17/4b
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 501:20 "/Users/fabiodiceglie/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fabiodiceglie/.npm/_logs/2022-01-22T10_33_07_875Z-debug-0.log
So you have 2 issues going on here.
Issue 1 has to do with create-react-app. The lib that powers create-react-app is react-scripts. As a part of react-scripts the lib tar is used. react-scripts is using an out of date version of tar that is no longer getting security updates. That's okay because it should only be used in development and you should be building and using that for production.
The second issue is your cache folder for npm is owned by root so it cant be used by non root users.
You should run:
sudo chown -R 501:20 "/Users/fabiodiceglie/.npm"
to fix it and then you should update npm with:
npm install npm@latest -g
so that you dont get this issue if you run as root again some time in the future.