1

I have tried this: sudo apt install nodejs

Getting Error this:

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 : Depends: python-minimal but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
0

1 Answer 1

1

Make sure your /etc/apt/sources.list file is correct.

Run the next command to find out what release version you use:

cat /etc/lsb-release | grep RELEASE

Then follow one of the next links to change your /etc/apt/sources.list file:

19.10 sources.list
18.04 sources.list
16.04 sources.list

You could backup your old sources.list file by sudo mv /etc/apt/sources.list /etc/apt/sources.list.bk and create new one pasting there content from one of the provided links.

Then do

sudo apt clean && sudo apt update && sudo apt install npm nodejs node-abbrev node-ansi node-rimraf

and try again.

Also make sure there's no suspicious repositories under /etc/apt/sources.list.d/ folder that could also contain nodejs of newer version that do not contain required dependencies.

4
  • Not able to save in /etc/apt/sources.list the 18.04 sources.list...permission denied Mar 30, 2020 at 15:25
  • 1
    use sudo command before your editor. For example sudo nano /etc/apt/sources.list or sudo -H gedit /etc/apt/sources.list
    – Gryu
    Mar 30, 2020 at 15:29
  • successfully installed nodejs version 10.19.0.....after i installed npm with link sudo apt install npm.... it return this error (written below) after that i checked npm version it shows 6.13.4 Mar 30, 2020 at 15:38
  • The following information may help to resolve the situation: The following packages have unmet dependencies: npm : Depends: nodejs but it is not going to be installed Depends: node-abbrev (>= 1.0.4) but it is not going to be installed Depends: node-ansi (>= 0.3.0-2) but it is not going to be insta Depends: node-rimraf (>= 2.2.2) but it is not going to b.................... E: Unable to correct problems, you have held broken packages. Mar 30, 2020 at 15:40

Not the answer you're looking for? Browse other questions tagged .