My wsl2 (ubuntu 20.04) is set to use root user.
I can install any node package that does not require a script to run. If it does require a script like the node-sass package then I get the error:
sh: 1: node: Permission denied
Same happens for npx commands like:
# npx npkill
/tmp/npx-a435a586.sh: 1: npkill: Permission denied
There are many threads here that state the fix is to set these values:
npm config set user 0
npm config set unsafe-perm true
But this does not change the behavior and the same error occurs. I have tried deleting node modules and also using the --unsafe-perm flag but it still has same error. I have also tried restarting after changing node settings.
My versions:
- node: v16.13.2
- npm: 8.15.0
- wsl: Ubuntu-20.04
Anything else I can try?