Live data from Hacker News

Ride down into JavaScript dependency hell

blog.appsignal.com

11–20 of 149 posts

Re: Ride down into JavaScript dependency hell

#11

express (common web framework) seems to have only 51 deps in lockfile jekyll has 13 I don't disagree that lots of deps = supply chain risk But there have always been variations between projects & kinds of projects re how many deps they pull in. Try following someone's ipython data science tutorial, it's requirements.txt for days I think lack of a standard lib early on plus hipster functional culture made the '10s JS…

A python equivalent to "express" would be Flask https://palletsprojects.com/p/flask/

I see 4 dependencies in the setup.py, and they are all from the same team of maintainers (i.e the Pallet team):

- Werkzeug

- Jinja2

- itsdangerous

- click

https://github.com/pallets/flask/blob/master/setup.py

https://github.com/pallets/flask/network/dependencies

Re: Ride down into JavaScript dependency hell

#13
Part of the issue is that JavaScript packages are often far far smaller than packages in other ecosystems.

"small packages are extremely common in the JavaScript npm package system. For example, in npm, 47% of the packages have 0 or 1 functions, and the average npm package has 112 physical lines of code. In contrast, the average Python module in the PyPI repository has 2,232 physical lines of code."

Source: "Vulnerabilities in the Core: Preliminary Report and Census II of Open Source Software", The Linux Foundation & The Laboratory for Innovation Science at Harvard, by Frank Nagle, Jessica Wilkerson, James Dana, Jennifer L. Hoffman. https://www.coreinfrastructure.org/programs/census-program-i...

(This is a contrast of citations from other works; you can see the specific citations in the report, but I'm trying to do this from a phone. In any case, the issue is the massive difference between JavaScript and everything else, and I think this quotation shows it nicely.)

Re: Ride down into JavaScript dependency hell

#14
post #4

So what does NPM do differently than plugin managers from other languages? I can't name one where the dependency hell is this big.

My personal take having “grown up” with all of this - JS is one of the worst ecosystems for relying on external packages for everything. It’s more the culture than the tooling. One of the things I love about Go is generally people are a little more forgiving to copying something around a couple times instead of making a lib for everything.

Inviting the question of why the culture hasn't sprouted a "package rationalizer" to produce a curated, tested, noise-filtered distribution of useful functionality.

Come to think of it, something that does for packages what jQuery did to bring (some) sanity to browser incompatibilities.

Re: Ride down into JavaScript dependency hell

#15
post #2

I'm not buying the narrative of "js dependency hell what are they thinking" anymore. Try installing a package for Rust. Or Go. Or ... any language, really.

There are bad packages in rust, go, python (1), even C. The worst of these are closer to the norm for JavaScript though. Personally I don’t feel comfortable running JavaScript packages outside of some kind of sandbox (usually a VM) on my personal computers.

(1) in fact, seeing some of the worst kept me away from python for far too long until I realized plenty of python software doesn’t even need pypi and most only need it for a couple things with no transitive dependencies

Re: Ride down into JavaScript dependency hell

#16
I have a project with a total of eight dependencies. I walked away for six months as it was stable. I come back to add a few features and npm tells me I have over 38 000 vulnerabilities of different severity levels. So many that 'npm audit' just freezes up.

So there's that too.

Re: Ride down into JavaScript dependency hell

#17
post #4

So what does NPM do differently than plugin managers from other languages? I can't name one where the dependency hell is this big.

My personal take having “grown up” with all of this - JS is one of the worst ecosystems for relying on external packages for everything. It’s more the culture than the tooling. One of the things I love about Go is generally people are a little more forgiving to copying something around a couple times instead of making a lib for everything.

Go in particular has an amazing standard library and very clear guidelines on how to write code. JavaScript does not have either of those things so it promotes people releasing competing libraries with similar functionality written in various different styles.

Re: Ride down into JavaScript dependency hell

#18
post #2

I'm not buying the narrative of "js dependency hell what are they thinking" anymore. Try installing a package for Rust. Or Go. Or ... any language, really.

Yes. Using third-party code is not a binary decision between “write everything yourself” and “use all the things”, it is part of the ongoing conversation about optimization: Development time, deployable size, build time, tool support, community support, training, documentation, etc.

Re: Ride down into JavaScript dependency hell

#19
I think that we are in a situation where the number of dependency doesn't have any meaning anymore for people working on web frontend projects. Recently while revamping parts of the CI/CD at $WORK, I found out that running npm install for one of our frontend project downloads around 1 million dependencies. And npm audit reports a completely ridiculous number of security issues with them.

It's just so absurd and nonsensical, nobody can understand what that even mean.

Seems to me to be a crazy huge liability, but quite a lot of people seem to be fine with that.

I don't know what to do from that information, but trying to create some awareness around the issue feels like talking about the number of operations per second a CPU does with someone who has zero idea what a realistic range is. It's seen as a high number, but doesn't have any meaning attached to it.

Edit: I don't have access to the project anymore to check more details (such as installation time), but I checked some personal notes I took when I found this out, the redacted output from npm audit is the following

    $ npm audit
     vulnerabilities found - Packages audited: 927016
    Severity:  Low |  Moderate
    Done in 41.62s.

So slightly below the 1 million mark.

Edit 2: Now I'm wondering ... maybe the "packages audited" from npm audit doesn't mean "you have that number of packages, and I audited them". But if that's the case, that's a terrible UX, and I have zero idea what that number mean, which kind of support my point.

Re: Ride down into JavaScript dependency hell

#20

I have a project with a total of eight dependencies. I walked away for six months as it was stable. I come back to add a few features and npm tells me I have over 38 000 vulnerabilities of different severity levels. So many that 'npm audit' just freezes up. So there's that too.

My stuff breaks whenever I try upgrade it. People refactoring stuff.
Post reply on HN