npm

02
Oct

Fixing NPM permissions errors on WSL

Saving this one for posterity since I seem to run into something like this once every couple of months. Really gotta get a Mac for my next dev machine.

sudo apt update && sudo apt upgrade -y

# Since you mention that you have set your user to be root:
sudo sh -c 'echo "[user]\ndefault=root" > /etc/wsl.conf'

wsl.exe -l -v
# Confirm your distribution name for the following command:
wsl.exe --terminate Ubuntu

Credit to this StackOverflow answer.