Steps to reproduce:

  1. Start a Node project that uses at least five direct dependencies.
  2. Leave it alone for three months.
  3. Come back and try to install it.

Something in the dependency tree will yell at you that it is deprecated or discontinued. That thing will not be one of your direct dependencies.

NPM will tell you that you have at least one security vulnerability. At least one of the vulnerabilities will be impossible to trigger in your particular application. At least one of the vulnerabilities will not be able to be fixed by updating the versions of your dependencies.

(I am sure I exaggerate, but not by much!)

Why is it like this? How many hours per week does this running-to-stay-in-place cost the average Node project? How many hours per week of developer time is the minimum viable Node project actually supposed to have available?

  • Sigmatics@lemmy.ca
    link
    fedilink
    arrow-up
    74
    arrow-down
    3
    ·
    1 year ago

    Because 99% of Node projects are web related, and if something’s vulnerable on the web it won’t take long to be abused

    • BrianTheeBiscuiteer@lemmy.world
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Also a great disadvantage with JavaScript being the official scripting language of the web so it needs to work in every browser, but not every browser will implement it the same way. Syntax between the browser and servers also gets conflated.

      I’ve done frontend development in Java and it sucks major ass. The “advantage” of using one language for the whole project really ended up as a net negative. For any server-side project I’m totally fine using Java because for all it’s verbosity it’s secure, performant, and examples from 10 years ago aren’t useless.

  • ono@lemmy.ca
    link
    fedilink
    English
    arrow-up
    21
    ·
    edit-2
    1 year ago

    My take: It’s because the “trust everything from everybody” model is fundamentally broken.

    Note that trust is not only about avoiding malicious or vulnerable code, but also about dependability. Even if you ignore the “supply chain” security problems inherent in this model, it practically guarantees that the breakage you describe will happen eventually.

    This is part of why I prefer languages with robust standard libraries, and why I am very picky about dependencies.

    • howlongisleft@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Thank god for proxy registries. I love Node, but it’s like using a house of cards as the foundation of a skyscraper.

      • BrianTheeBiscuiteer@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        The fact that NPM can’t use multiple registries (yes, I know about scoped registries) is astounding. For every other language my org will separate artifacts into half a dozen or so virtual repos. The artifact team is quite annoyed that Node/JavaScript has to all go into one uber-repo.

    • 𝒍𝒆𝒎𝒂𝒏𝒏@lemmy.one
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I personally don’t trust NodeJS libraries that much - I always run projects inside Docker as a regular user with access to the working directory, just in case the supply chain is poisoned.

      In the case of Python, particularly when I was testing out the LLaMA model, I just stood up a new VM for that. Back then safetensors wasn’t a thing, and the model tensor file format (python pickle-based) could potentially store arbitary code.

      Robust standard libraries are amazing to have.

  • AA5B@lemmy.world
    link
    fedilink
    arrow-up
    21
    arrow-down
    2
    ·
    1 year ago

    They’re all that way: it’s just that Node is automatic enough to notice more easily, plus had an insane number of small dependencies

    We started doing vulnerability scans on every build, which sounds like a good idea. However, now I know: Java is exactly the same. We need to constantly update but all too often there is no update available yet

    • body_by_make@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 year ago

      C# is also exactly the same, you just don’t get yelled at when things are out of date and you only see that if you go to manually install packages

  • Paradox@lemdro.id
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    1
    ·
    1 year ago

    For most projects or tools that I find on GitHub these days, I run them all in docker. Node, at least, is somewhat of a good guest. All it’s crap lives in node_modules, and so when I’m done, rm the directory and it’s all clean. Python seems to love leaving relics across my system

  • Treczoks@lemm.ee
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

    Welcome to my world. Not that I’m using node, but I’m using mediawiki. They manage to f-up something with about every update, and the documentation, if it exists at all, is often enough completely wrong or broken.

    • ck_@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Been there, Mediawiki is truely painful, especially if you are trying to maintain an extension or two “on the side”.

      • Treczoks@lemm.ee
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        That is exactly the case here. I’ve got a private wiki with a rather large extension by now, and it is the only PHP project I have. So whenever mediawiki f-cks something up, which is nearly every update, I restart my PHP skills to find and fix the sh-t they did to my code this time.

  • peereboominc@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I wonder if it has something to do with the framework you pick. There are probably frameworks that aim to be as stable as possible but lack the cutting edge.

  • lysdexic@programming.dev
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    3
    ·
    1 year ago

    Something in the dependency tree will yell at you that it is deprecated or discontinued.

    Only if you didn’t pinned the dependencies you actually consume, and expect that all your dependencies magically comply with semver.

    Blindly replacing dependency versions never worked, at least reliably. If you do not put in the work to ensure things work, more often than not you’ll be surprised by them not working.

    • planish@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Often it seems that people will make patch releases that add a “feature” of complaining at install time that that major release/minor release/entire package is bad now and should be replaced with something else. It still works, but it annoys everyone who transitively depends on it forevermore.