0

PROBLEM
I need to downgrade my node.js version, to avoid Problems with Vue CLI.

https://stackoverflow.com/a/60277789
I tried doing the steps in this answer

sudo npm install -g n  

After running this command i get a weird error:
sudo: npm: command not found

So i tried running it without sudo and got the following output:
changed 1 package, and audited 2 packages in 1s
found 0 vulnerabilities

When i run

sudo n 14.17.5  

i get the error: sudo: n: command not found

QUESTION
What is going on here?
Is there another way to change the version of node?

Also, i read somewhere that the npm prefix could be the issue:

/home/user/.nvm/versions/node/v16.13.2/lib/node_modules/node/lib/node_modules/node
akurz
  • 1
  • Based on that last path, you may already be using nvm. n is a node version manager, nvm is a node version manager, and I recommend you use one or the other and not both! Try "nvm use 14" to switch to the latest version of Node.js v14. (If you want to use n, uninstall nvm first.) – shadowspawn Jan 16 '22 at 04:24
  • There can be differences in the PATH variable between running commands with and without sudo. Compare the PATH variable listed in "sudo env" and "env" to see if this is the case you for. However, I recommend you avoid needing to use sudo when installing global node modules by changing the install location (which both n and nvm support), or by changing folder permissions. – shadowspawn Jan 16 '22 at 04:28

0 Answers0