Question

node -v and nodejs -v different output

Hello everyone, I’m giving a try to Q&A since this community looks awesome. I state that I am no ubuntu expert, and I’ve been following (surprisingly successfull!) many tutorials to set up my droplet till now. I wanted to update my nodejs to the latest lts version (currently 10.13.0) and I thought of doing so with nvm. So i installed it, and got the version I wanted, everything seem okay, but I’m worried cause of different output version:

node -v
v10.13.0
nodejs -v
v8.10.0

Did I miss something? Should I uninstall nodejs with sudo apt remove nodejs - since I am now using nvm?

Thanks for helping out, good coding to you all ✨

Subscribe
Share

what a mess. I would like to be able to install and update all packages in Ubuntu using apt. This thread is indicating that for node.js that there is a competing way to install/update node.js. Again, what a mess.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’d rather use nvm to be able to switch node version with ease if I needed to, I’m used to nvm working locally so I’d really love to stick with it! From what you said I understand that right now I have 2 “instances” of node installed? To keep it clean using nvm I should uninstall nodejs ubuntu version? I was assuming that nvm would have “took control” of the nodejs version that was already there instead of adding another one on top. I just want to be sure I’m not uninstalling the nodejs I am using right now… How can I be sure which one my apps are actually running on? 😕

Both /usr/bin/node and /usr/bin/nodejs are provided by the nodejs package in Ubuntu which is currently version 8.10.0 in Ubuntu’s repositories.

Meanwhile, NVM provides the latest LTS, 10.13.0.

This does indeed sound like /usr/bin/node is from the NVM version whereas /usr/bin/nodejs is from the Ubuntu version.

Personally, rather than use NVM, I’d recommend Node’s officially recommended Ubuntu packages. That way there won’t be any conflicts with the Ubuntu version. Alternatively, you could uninstall the Ubuntu version then reinstall the NVM version.