Package 'npm' has no installation candidate - node.js

I want to install npm in Debian 9.
I've tried:
apt-get install nodejs
completely installed and nodejs -v results: v4.8.2.
but when try to run npm an error says:
bash: npm: command not found
Base on my searches I've tried other ways:
based on this guide: https://www.godaddy.com/help/install-nodejs-ubuntu-17395 I've tried:
sudo apt-get install npm
results:
E: Package 'npm' has no installation candidate
Based on another guide I've tried:
wget https://npmjs.org/install.sh
sudo chmod +x install.sh
sudo ./install.sh
results:
npm cannot be installed without node.js.
of course I've installed nodejs. I also tried this way:
curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get update
sudo apt-get install --yes nodejs
It says:
nodejs is already the newest version (4.8.2~dfsg-1).
What should I do?

Remove the old version
sudo apt-get purge nodejs
Install the new version:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Alternatively, for Node.js 9:
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
Source
It might tell you that you are missing package gnupg2, just install it.

Related

Getting python2 error in nodejs installation in Ubuntu 20.04

I've updated to the new Ubuntu 20.04LTS version and all my node installations have gone. So to install node I have tried the following 2 methods:
1.sudo apt update
sudo apt install nodejs npm
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
While installing nodejs I'm getting the error : nodejs : Depends: python2-minimal but it is not installable . Unable to correct problems, you have held broken packages.
screenshot
You need to install python2. Steps in Ubuntu 20
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install python2
This will install python2 successfully. Now you can continue with normal nodejs installation
I had a similar problem and solved it by following the instructions on https://speedysense.com/install-nodejs-on-ubuntu-20-04/
Tldr run these on a terminal: for current LTS Release (v14.x),
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Afterwards check your Nodejs and npm version by running these on a terminal:
node --version
npm --version

How To Install Node Js In Ubuntu 18.10?

i'm trying to install nodejs in Ubuntu 18.10 but it returns some error.
The following packages have unmet dependencies:
nodejs : Depends: python-minimal but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Above is the message i get while install node Js by cammand: sudo apt-get install nodejs.
As described in this link:
Install node version manager:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
Activate nvm:
. ~/.nvm/nvm.sh
Use nvm to install the version of node you want:
nvm install 4.4.5
Test that Node.js is installed:
node -e "console.log('Running Node.js ' + process.version)"
The recommended way to install node under Ubuntu appears to be to use the archives provided by NodeSource.
Their instructions are to run these shell commands to, presumably, set up a PPM and install a current version of node from that source.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
First you need to install python 2.7 using following commands
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python2.7
then install nodejs
sudo apt-get install nodejs
Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
apt-get install -y nodejs

I can not install the nodejs 6 on ubuntu

At first I installed the node with terminal, with command
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
It works, but when I am looking version node, I see node v 4
Then I used google for search this problem and a found this topic
https://stackoverflow.com/a/43914369
There using a ln command for create symbolic link between two files
and used this instruction for manual install, but nothing happens, error appears and not installing
Look at this screenshot
Maybe I doing anything wrong?
I tend to avoid using my operating system's package manager to install node. The easiest way to install node is Node Version Manager.
Yeah! The solutions found in official site
Of course link Install node version 6
Can you please check:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
but for this you need curl to be installed.
sudo apt-get update
To install curl: sudo apt-get install curl
Here's the link for this.
To upgrade node to latest version: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version#480642

I'm new to Ubuntu and I can't seem to get this Curl command to work. How can I install nodejs 7.x on Ubuntu 16.04?

sudo apt-get update&&sudo apt-get dist-upgrade
sudo apt-get install curl
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
and the curl command fails when trying to enter, says "bash: -d: command error
Solved it, I dunno why but I had to type:
sudo apt-get install -y nodejs
sudo apt-get purge nodejs npm
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
and that seemed to actually install 4.2, remove it, then install 7.x

Error when adding generator-jhipster via YARN

I ran the following command to install the generator-jhipster via yarn:
yarn global add generator-jhipster
After doing so, I ran into the following issue:
The engine "node" is incompatible with this module. Expected version ">=6.9.5"
Any clue as to how I can get around this issue?
TIA
Install node 6.9.5 or more recent.
Update node to the latest version.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Once your install is complete, you can confirm you version with another command:
node -v
To Download latest node
https://nodejs.org/en/download/package-manager/
Node.js v5:
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
Node.js v6:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Node.js v7::
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
Node.js v8::
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
You can also try to use
yarn --ignore-engines

Resources