I am trying to learn how to use node.js in centos 8
I have installed node.js and npm, and using npm I have installed inherits and n
I have been following tutorials on different websites and have been installing various node.js based software on this computer, and I managed to have two versions on node.js installed on this computer
I normally use this computer as the user 'username', and going to a terminal and typing node -v as 'username' gives me
v12.16.3
However, if I type in sudo node -v, I get
v10.21.0
I think that this is a mistake and I should only have v12.16.3 installed, and I don't know how I ended up doing this. How do I keep v12.16.3 and delete other versions of node? If it is safe for them to coexist, how do I make sudo use the v12 version of node?
EDIT:
I believe the v12.16.3 version is installed at /usr/local/bin/node and the v10.21.0 is at /bin/node but I don't know how this ended up happening. If I understand correctly, /usr/local/bin/ is similar to Window's Program Files but for programs installed for my current user, while /bin/ is like the root user's Program Files? Is this a good way to understand this? I'm not sure what I did to have a lower version of node.js to also get installed, but I don't think I need this version. Issuing sudo yum list installed only shows me a single nodejs.x86_64 entry. Does Centos have equivalent of Window's Add/remove program list that clearly lists what programs I have installed?
yumyou can useyum history listto show the transactions, and then inspect them, this may help you understand when/how you got the other version. You can also useyum provides /usr/local/bin/nodeto see if ayuminstalled package is responsible for the secondnodeversionsudo yum provides /usr/local/bin/nodegives meError: no matches foundsudo yum history list | grep nodegives me a single entry forinstall nodejs/usr/local/bin/nodeversion was installed via another means than theyumpackage manager (possibly vianpm install node?), and in this case, you have to set the environment to use the non-yuminstalled version (you should probably see that your user account has/usr/local/binin thePATHvariable if you doecho $PATH).