0

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?

7
  • If you have only installed packages via yum you can use yum history list to show the transactions, and then inspect them, this may help you understand when/how you got the other version. You can also use yum provides /usr/local/bin/node to see if a yum installed package is responsible for the second node version Commented Jun 15, 2020 at 10:26
  • @einfeyn496 sudo yum provides /usr/local/bin/node gives me Error: no matches found Commented Jun 15, 2020 at 10:31
  • @einfeyn496 sudo yum history list | grep node gives me a single entry for install nodejs Commented Jun 15, 2020 at 10:32
  • @einfeyn496 I have enabled epel-release and installed things using npm, but as far as I understand I initially installed node using yum Commented Jun 15, 2020 at 10:33
  • It appears then that the /usr/local/bin/node version was installed via another means than the yum package manager (possibly via npm install node?), and in this case, you have to set the environment to use the non-yum installed version (you should probably see that your user account has /usr/local/bin in the PATH variable if you do echo $PATH). Commented Jun 15, 2020 at 11:25

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.