## The solution I followed to solve this problem:
1. Go to folder C:Program Files
odejs
2. You have to edit four files named npm, npm.cmd, npx, npx.cmd
3. Open the files in a text editor, like Visual Studio Code
4. Replace prefix -g with prefix --location=global in all four files
5. Save all (if asked, save as administrator)
6. Good to go!
ref: https://stackoverflow.com/a/72545277