When deploying Node and NPM on Ubuntu 20.04 I noticed that when you run sudo apt install npm it details a massive number of dependencies that it want's to install with it. Why is this? Surely it doesn't require all these packages to run the package manager?

  • JavaScript is not known for being light. Is this a serious question? You are asking if dependencies are really dependencies.
    – Nmath
    Aug 25, 2020 at 5:22
  • "Why is this?" is asking for opinions. You need to ask the creator of npm.
    – Rinzwind
    Aug 25, 2020 at 6:43
  • 1
    @Rinzwind If I was looking for an opinion it would have been "What is your opinion" smh. Nmath, I understand that JS has a lot of dependencies but at the time of writing that I didn't realise NPM itself was written in JS, so it makes sense now that it has so many dependencies. Aug 27, 2020 at 7:10
  • 1
    Glad I'm not the only one who had this question...
    – jobo3208
    Jun 7, 2022 at 0:51

1 Answer 1


You can reduce the number of installed packages by providing --no-install-recommends:

sudo apt-get install npm --no-install-recommends

Comparison for minimal 20.04 LTS system:

  • sudo apt-get install npm

    0 upgraded, 516 newly installed, 0 to remove and 0 not upgraded.

  • sudo apt-get install npm --no-install-recommends

    0 upgraded, 313 newly installed, 0 to remove and 0 not upgraded.

  • 4
    This does not answer the "why is this" :-)
    – Rinzwind
    Aug 25, 2020 at 6:44
  • The big recommanded pkgs comes from "build-essential". Cf apt install -s -o Debug::pkgDepCache::AutoInstall=true npm 2>&1 | grep Recommends Jan 11, 2022 at 10:13
  • Nowadays on raspbian bases on Debian 10 Buster form npm version 5.8.0+ds6-4+deb10u2 ... sudo apt install npm = 247 deps and sudo apt install npm --no-install-recommends = 246 deps :D So almost no difference.
    – mikep
    Jun 9, 2022 at 7:33
  • Why is this not the default? This brought the install size down from 600MB to 117MB. The Windows installer (the Node install MSI) by comparison is only 25MB.
    – Ian Smith
    Nov 22, 2023 at 22:49

You must log in to answer this question.

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