So I am trying to follow along on a Youtube tutorial for a react project. (I'm on Windows 10, there are other solutions that explain how to solve this on linux and mac, which could work because I'm running this code on my Linux subsystem aka Ubuntu, also tried running as admin)
I thought I had npm and node installed from before but I seem to be running into some strange errors. So first I ran npm install once I cloned this person's project. So I then run
npm install (it gives the following output)
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/serve-index
npm ERR! dest /mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setumnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE'
npm ERR! { [Error: EACCES: permission denied, rename '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/> '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE']
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, rename '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder
-> '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path:
npm ERR! '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/serve-index',
npm ERR! dest:
npm ERR! '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE'
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, rename \'/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder -> \'/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path:
npm ERR! '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/serve-index',
npm ERR! dest:
npm ERR! '/mnt/c/Users/major/OneDrive/Desktop/react-projects/01-birthday-reminder/setup/node_modules/.serve-index.DELETE',
npm ERR! parent: 'setup' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/major/.npm/_logs/2021-11-13T18_58_07_804Z-debug.log
So some answers suggest that I should reinstall npm and that seems to make sense but all places seem to indicate that I should first remove all npm items in usr/local/lib BUT that's a location only on Mac and Linux so I am at a loss on where to even begin.
Some other places suggest to change the permissions as stated in the error log above (shown here again)
npm WARN checkPermissions Missing write access to /usr/local/lib
npm WARN notsup Unsupported engine for npm@8.1.3: wanted: {"node":"^12.13.0 || ^14.15.0 || >=16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: npm@8.1.3
Let's ignore the fact that I DON'T EVEN HAVE /usr/local/lib But assuming it's hidden, I can't change the permissions with
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
Any ideas on how to fix this? I could really use it :S