Installing npm in Ubuntu - node.js

I am truly struggling to install npm. I have installed the nodejs package successfully, but still my operating system Ubuntu 15.10 (Wily Werewolf) doesn't recognize the npm command like it is shown below, even though after several update attempts with sudo apt-get update:
user#user-T420:~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
The following packages were automatically installed and are no longer required:
authbind diffstat hardening-includes libapt-pkg-perl libarchive-zip-perl
libbonobo2-0 libbonobo2-common libcamel-1.2-29 libclass-accessor-perl
libclone-perl libedataserver-1.2-15 libemail-valid-perl libgles1-mesa
libgnome2-0 libgnome2-bin libgnome2-common libidl-common libidl0
libindicate5 libio-pty-perl libio-string-perl libipc-run-perl
libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl liborbit2
libperlio-gzip-perl libpoppler19 libqt5x11extras5 libsdl-image1.2
libtext-levenshtein-perl libtiff4 libva-drm1 libxcb-composite0 libxcb-xv0
linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic
linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic patchutils
t1utils vlc-plugin-notify vlc-plugin-samba
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
user#user-T420:~$ npm -v
The program 'npm' is currently not installed. You can install it by typing:
sudo apt-get install npm
user#user-T420:~$ sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
user#user-T420:~$ sudo apt-get install nodejs-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nodejs-dev : Depends: libssl-dev (>= 1.0.0g) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
user#user-T420:~$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.0.0 (= 1.0.1-4ubuntu5.36) but 1.0.2d-0ubuntu1.4 is to be installed
Depends: zlib1g-dev but it is not going to be installed
Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
user#user-T420:~$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
zlib1g-dev : Depends: zlib1g (= 1:1.2.3.4.dfsg-3ubuntu4) but 1:1.2.8.dfsg-2ubuntu4 is to be installed
E: Unable to correct problems, you have held broken packages.
It looks an infinite tree of dependencies. Is there a solution to fix it?
If this would be of any help, here's my sources.list file:
#############################################################
############### OFFICIAL UBUNTU REPOSITORIES ################
#############################################################
###### Ubuntu Main Repositories
deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
###### Ubuntu Partner Repository
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner
###### Ubuntu Extras Repository
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main

Use aptitude instead of apt-get. It is more intelligent. It not only will handle downgrading conflicting packages for you, but it will make a series of recommendations asking you which of many possible suggested working scenarios you would like.
sudo aptitude install myNewPackage
If you don't have aptitude on your machine yet, get it with
sudo apt-get install aptitude

Related

“E: Unable to locate package python3-pip” in Debian 10

For installing pip3 I am following apt update process.
But I am getting output in terminal:
$ sudo apt-get update
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-pip
Tried all available solutions on stackoverflow.
Please suggest any solutions.
Sometimes the sources.list file is not configured properly, so if none of solutions work than try this:
Type in terminal, gedit etc/apt/sources.list. A file will open, check if these given lines are present or not in that file:
deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main
deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main
In my case these were missing, this means the apt-get command had no mirrors configured to pull and update packages. These lines are the links to Debian repositories from where packages are pulled.
Copy and paste these lines into that file and save and close it.
Now run sudo apt-get update and than run sudo apt-get upgrade. Once process finishes run sudo apt-get install -y python3-pip. This will install pip3 without any error.
Please run an update and upgrade,
sudo apt update && sudo apt upgrade
Hopefully, this will fix the issue. if this doesn't work you can always update the source list manually.

Unable to install update-notifier-common on Debian Stretch

I'm currently trying to install some fonts on Debian Stretch
g#i-3-nstance:~$ sudo apt-get install ttf-mscorefonts-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ttf-mscorefonts-installer : Depends: update-notifier-common (>= 0.119ubuntu2) but it is not installable
E: Unable to correct problems, you have held broken packages.
g#i-3-nstance:~$
...but it seems this package has been removed.
https://github.com/plone/ansible-playbook/issues/98
https://github.com/jnv/ansible-role-unattended-upgrades/issues/6#issuecomment-93569818
Is there a work-around?
Update: I did a manual install based on this: https://askubuntu.com/a/861476
sudo apt-get install cabextract libmspack0
wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb
sudo dpkg -i ttf-mscorefonts-installer_3.6_all.deb
The ttf-mscorefonts-installer package that apt-get tries to install is from Ubuntu repository, not from Debian repository (note that it depends on update-notifier-common >= 0.119ubuntu2).
You probably have mixed Debian and Ubuntu repositories in /etc/apt/sources.list.

Debian APT unable to install any package [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I am running Debian 9 with XFCE4 on Dell XPS 15 (9560). Recently I ran into trouble with apt. If I try to run anything using apt-get install, the following always return:
william#debian:~$ sudo apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
vim : Depends: vim-common (= 2:7.4.488-7+deb8u3) but 2:8.0.0197-4+deb9u1 is to be installed
E: Unable to correct problems, you have held broken packages.
I have tried running sudo apt-get update, sudo apt-get upgrade, sudo apt --fix-broken install, sudo apt-get clean, and etc, etc.
Some of them return messages like this:
william#debian:~$ sudo apt-get update
Ign:1 http://ftp.us.debian.org/debian jessie InRelease
Hit:2 http://ftp.us.debian.org/debian jessie Release
Reading package lists... Done
william#debian:~$ sudo apt-get install upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package upgrade
william#debian:~$ sudo apt-get install dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dist-upgrade
Please help and thanks a lot :)
Please update your sources.list file......
Use terminal and open using permission
$ sudo gedit /etc/apt/sources.list
Paste the links here , you can find them on internet
Or paste these :
deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main
deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main
deb http://security.debian.org/debian-security/ stretch/updates main
deb-src http://security.debian.org/debian-security/ stretch/updates main
Thanku for asking amd sorry if im wrong somewhere 😊

Ubuntu, Cannot install zlib1g-dev

I'm trying to install nodejs in Ubuntu, after checking all the missing dependencies I encounter an issue when installing zlib1g-dev, zlib1g is already at 1:1.2.8.dfsg-2ubuntu4.1 :
[pp#src]$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
zlib1g-dev : **Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.1 is to be installed**
E: Unable to correct problems, you have held broken packages.
[pp#src]$ sudo apt-get install zlib1g
Reading package lists... Done
Building dependency tree
Reading state information... Done
**zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4.1)**.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I was able to do the installation with:
sudo apt-get update && sudo sudo apt-get install zlib1g-dev
After updating /etc/apt/sources.list with the following:
#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse
###### Ubuntu Update Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse
deb http://us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse
###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
I would try a sudo apt-get update to start (sometimes the problem is trivial!).
Consider including the results of dpkg --get-selections | grep hold
in the comments.
Autoremove might help, too!
Finally, trying again with aptitude (https://unix.stackexchange.com/questions/767/what-is-the-real-difference-between-apt-get-and-aptitude-how-about-wajig) might highlight the issue.
Tough to diagnose without more information.
Answer for this is given by SeinopSys in Error installing zlib1g-dev
you need to take note of the required package version (in your case = = 1:1.2.8.dfsg-2ubuntu4), then run the command below to downgrade to that version:
$ sudo apt install zlib1g== 1:1.2.8.dfsg-2ubuntu4
Then you can try re-installing.

Unable to install libgtk2.0-dev on Raspberry Pi 2

I am trying to install libgtk2.0-dev on my Raspberry Pi 2 running on latest raspbian. When I use the command sudo apt-get install libgtk2.0-dev, I get the following dependency errors:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgtk2.0-dev : Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I tried fixing the broken packages using sudo apt-get install -f, sudo apt-get update, sudo apt-get upgrade and then sudo apt-get install libgtk2.0-dev. It still didn't work. I tried apt-get install on the dependencies and their dependencies, but the result is the same. The solutions in link1 and link2 did not help either.
My source.list contains:
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi
Am I missing something in my source.list? How can I resolve this?
apt-cache policy libgtk2.0-dev libpango1.0-dev libcairo2-dev showed that the problem was with /etc/apt/sources.list.d/raspi.list.
raspi.list contained deb http://archive.raspberrypi.org/debian/ wheezy main. Changed wheezy to jessie, ran apt-get update and then running apt-get install libgtk2.0-dev worked.
Use aptitude instead:
sudo aptitude install libglib2.0-dev

Resources