Biplov
Biplov

Reputation: 1142

Having issues installing nodejs/npm

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.

Upvotes: 2

Views: 3884

Answers (3)

Nermin Türk
Nermin Türk

Reputation: 11

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

Upvotes: 0

quantumThinker
quantumThinker

Reputation: 156

Try apt-get updateto update the list.

Upvotes: 4

Rafael del Rio
Rafael del Rio

Reputation: 208

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)"

Upvotes: 1

Related Questions