2

I've completely uninstalled nodejs/npm both.

However they seem to be throwing same error consistently whilst installing. I've also tried sudo-apt get update sudo apt cache verify and apt cache search, when I search nodejs is not found or npm.

The program 'nodejs' is currently not installed. You can install it by typing:
sudo apt-get install nodejs

And when I do sudo apt-get intall nodejs

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package nodejs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nodejs' has no installation candidate

I've made sure nodejs/npm is removed from /usr/bin etc. Still doesn't seem to be working at all.

3 Answers 3

4

Try apt-get updateto update the list.

Sign up to request clarification or add additional context in comments.

Comments

1

Try

This will install node version manager (nvm) by typing the following at the command line. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash

Then activate nvm by typing the following at the command line. . ~/.nvm/nvm.sh

Then Use nvm to install the version of Node.js you intend to use by typing the following at the command line. nvm install 4.4.5 (you can install 6.1.0 LTS for instance)

then test it by typing node -e "console.log('Running Node.js ' + process.version)"

7 Comments

To run nodejs, is it going to be nodejs in command line or node? Are they the same thing?
On cli you will need to type node
What do I do for NPM as-well?
Yes, they are the same thing, usually people refer to node.js as node or nodejs just to short its name. Like when some people refer to react.js as react or reactjs. On cli, it's node the default created alias.
Node installs npm by default. Altough, you can update npm by typing npm install npm@latest -g
|
0

Install NPM and Node.js from the Official Ubuntu Repository. First, connect to your server using ssh: ssh username @ server_ip_address After connecting, refresh the APT cache : sudo apt update Node.js setup : sudo apt install nodejs You can also install NPM, the Node.js package manager: sudo apt install npm Finally check the installed version : nodejs -v To delete node.js, run this command: sudo apt remove nodejs

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.