React Vite Installation Error

Hi Terrence. Have you ever run the npm command prefixed with sudo? If so you should generally avoid this as it will create files and directories owned by root that will be inaccessible to your login account. When you run ls -l /Users/terrence/.npm, does the root user own the files and directories within?

For instance, something like this:

$ls -l /Users/terrence/.npm
drwxr-xr-x   5 root  wheel   160 May 31  2020 _cacache
drwxr-xr-x   2 root  wheel    64 Mar  6  2021 _locks

If you see root wheel (on MacOS) then you will need to use the chown command to change the ownership of .npm and all of its contents to your user. Assuming you’re on MacOS, run this and enter your login account password when prompted:

sudo chown -R terrence:staff /Users/terrence/.npm

Hope this helps.