Laravel "npm install" downloads 30.000+ items
Asked Answered
V

1

6

I am following the Laravel docs and wanted to install Elixir for managing sass and other preprocessors.

But as I start "npm install" from the laravel root folder, I end up with:

114.316.724 bytes (220,3 MB on disk) for 35.861 items

in the node_modules folder!

Please tell me that Elixir or Gulp does not need this ridiculous amount of dependencies, or did I something wrong?

The package.json contains:

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "laravel-elixir": "^5.0.0",
    "bootstrap-sass": "^3.3.0"
  }
}
Viborg answered 21/8, 2016 at 6:30 Comment(5)
Why is this ridiculous again?Underplay
npm is ridiculous, but yes, this is what goes for "normal" in the npm world.Tinstone
Let say someone needs only a Sass and no other preprocessor. But after loading Elixir you end up with 30.000+ files from which u may use only 2%. I think Gulp should have an option for specifying which packages to install in case the user needs just a few.Viborg
I rather go with Ruby for this feature, and stay away from npm, yikes!Viborg
Yeah, it's crazy, but at the moment this is all we have for node/js. I'd rather have npm than nothing but it is truly ridiculous. I'm just waiting for the next left pad disaster x 10.Tinstone
U
0

The reason why npm downloads so much items, is that each item in your dependencies also have a package.json file, and in each of those files, more dependencies are declared. This creates a complex dependency tree.

There is no way around the fact that it requires 200mb of packages to run elixir, although the core team of Laravel now recommends Yarn as your package manager (https://yarnpkg.com/lang/en/), to drastically speed up your node-fu.

I personally see 5-10x speed in package installations.

Unpeg answered 30/7, 2017 at 6:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.