I was using the old version of nodejs. Then i removed the old version using "rm rf- " command, but it was still showing the version when i run the "node -v " command, so i searched and deleted some more files. Now when i try to install:- it does not install and show the following message:-

sudo apt-get install npm Reading package lists... Done Building dependency tree
Reading state information... Done npm is already the newest version (3.5.2-0ubuntu4). 0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.

1 Answer 1


the best way to figure this out is use: whereis node this will help you pinpoint where the current package is. navigate there and make sure the package is not a symlink (because if it is, apt-get might not work for you)

also, as far as I remember there was something called nodejs-legacy so make sure you don't have this installed, too.

Once all is uninstalled I highly suggest using node version manager: https://github.com/creationix/nvm (helpful hint: read readme and installer output VERY carefully to avoid installation issues)

I suggest using nvm, because ubuntu repository doesn't keep node version up to date, and it's way easier to switch between them if your project happens to use older release as a dependency.

  • Thanks @janmyszkier...successfully resolved the issue.And surely NVM is the best way to install the nodejs and upgrading version. Mar 2, 2019 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.