-1

I recently installed mint and I'm doing some tests on VSCode, I'm a long time windows user but I ran into a problem. I program nodejs and when I run npm install, it gives permission access errors and I want to know if there's a way around it that isn't running vscode as super user. Error:

npm WARN checkPermissions Missing write access to /home/dotta/Documents/Udemy Codes/surf_shop/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /home/dotta/Documents/Udemy Codes/surf_shop/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/home/dotta/Documents/Udemy Codes/surf_shop/node_modules'
kaylum
  • 13,833
  • 2
  • 22
  • 31

2 Answers2

1

Run the following

ls -la /home/dotta/Documents/Udemy\ Codes/surf_shop you will see that its owned by root, why because you run sudo npm install at some point.

To fix:

  1. Delete node_modules:

sudo rm -rf /home/dotta/Documents/Udemy\ Codes/surf_shop/node_modules

  1. Then fix ownership permissions:

sudo chown dotta:dotta -R /home/dotta/Documents/Udemy\ Codes

Then you will be able to npm install, don't use sudo to install or make directories else when you want to do stuff as a normal user you wont own the directory or file.

Also dont start vs-code as root i.e: sudo code . else any point within vs-code its making folders/files as root.

... sidenote, avoid spaces in folders or filenames.

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
0

you need to give VSCODE admin right,go to VSCODE icon click right button -> properties -> advanced -> grant admin right and close all old terminals on VSCODE ,open a new one and enjoy !