Nodejs appear installed but "--version" is not working. On Ubuntu 20.04 LTS

I am having trouble in installing nodejs, npm and a specific version of angularCli. THe problem is that nodejs appears installed when I use the command

sudo apt install nodejs

but appears not installed when I check for the version. By using the command which, I am not finding any of nodejs, npm or ng

Like I am showing in the screen.

2

1 Answer

the Node version at the default Apt PPA is broken. The package is no longer maintained and hasn't been for a while now. It is stuck at version 10, whereas the current official stable release is 17.X.XX. The version is so old that it will not work (trying to use via command line will just give a version deprecation warning), and the NPM configuration installs in a way that anything installed with npm install xxxxx will not be useable.

My advice is to uninstall via apt remove and reinstall via curl or wget, or else add the NodeSource PPAs to sources.list and install from there. See here.

Be sure to uninstall the Ubuntu Repository package first. Otherwise, the system may give the Apt-installed binary priority.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like