Reputation: 1104
initially I was using Node v10 (I believe) and when generating a new angular project (v7) my node_modules were a "modest" ~140 Mb.
I then decided to upgrade to Node v11.1 and install the build-tools, that the installer now optionally allows you to install. My node_modules size went to over 700 MB. The culprit is the node-sass package, which is now downloading the whole project (cpp files, .sln and all) and getting fully compiled on the initial npm install (using node-gyp).
Is there any way to change this behavior to the way it did things without the installed build tools? (short of manually uninstalling the build pipeline that node automatically installed)
Or is there any advantage that I'm not seeing? To me it all worked just fine (including everything scss and sass-related) without the huge increase in occupied space.
Upvotes: 2
Views: 524
Reputation: 1104
So, I found out what's going on.
The current version of angular (cli version 7.0.6) installs node-sass at version 4.9.3. Version 4.9.3 does not support node v11. Support for node v11 was added with 4.10.0. As such the install script that node-sass is running can't find a pre-built binary to download from github and falls back to building the source files (which results in 400 MB wasted space).
That's why the problem started cropping up after I updated to the latest node version.
For now there's 2 solutions:
I went with option 1 and installed the LTS node version. This is a problem that will probably fix itself in time, as angular updates its node-sass dependency. For the time being I hope the answer will help someone facing the same situation.
Upvotes: 2