Quickfix

Dev tools

package management patching

SHOW HN2017

Quickfix

The best stupid idea for fixing problems in Node modules

github.com

#node modules#npm patch#dependency patching#node.js

61points
33comments
#696of 2,242 in 2017
Top 32%of 2017 by points

How HN took it

RoastedHalf or more of the comments are critical

2 positive, 3 neutral or asking, 0 mixed, 5 critical, out of 10 comments about the project. Thread score -0.20.

Idea: 2 for, 3 againstDesign: 0 for, 2 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clever and funny idea that could be useful in practice

    From 3 comments
    • Clever and funny. I might find this useful for broken Typescript typings that have been somehow included in the package.
      rendall on HN
    • That's basically all this is, but with fewer commands to remember and modify. I think that's quite useful, especially when under lots of time pressure.
      zbentley on HN
    • That is a very concise way of saying something I've struggled to articulate well in the past. Sometimes stuff like this is a horrible idea. Sometimes you need it. If you lock out…
      zbentley on HN

Objections

  • Patches to node_modules are fragile and break when dependencies change

    From 2 comments
    • A safer way in my opinion is to: 0. read module license 1. checkout the module to be patched 2. modify it 3. do "npm pack" to save a tarball 4. set the dependency version in your…
      partycoder on HN
    • This is a terrible idea and I encourage you to consider the slipperiness of this slope
      arthurcolle on HN
  • Committing or forking dependencies is a safer approach

    From 3 comments
    • Check in your node_modules. You are badly correcting the wrong problem. npm repo should not be hit for every checkout, deploy, and CI test. Just commit your dependencies - and if…
      limsup on HN
    • One of the really nice things about NPM (and other modern source-level dependency managers) is that it's trivial to fork dependencies and reference commits in remote Git…
      Benjamin_Dobell on HN
    • You have three options: 1. Fork every dependency in the chain. Which typically isn't more than two or three dependencies. 2. Fork the distant dependency, and specify it as a…
      Benjamin_Dobell on HN
  • Promotes bad practices and licensing risk

    From 2 comments
    • A safer way in my opinion is to: 0. read module license 1. checkout the module to be patched 2. modify it 3. do "npm pack" to save a tarball 4. set the dependency version in your…
      partycoder on HN
    • Oh, that's terrible, awful, the worst idea ever! You're promoting bad practices, the quality of code will only get worse from now on! Someone needs to delete this thread! You…
      fiatjaf on HN

Questions

  • How does it work for transitive dependencies?

    From 1 comment
    • How (well) does this work in a dependency of a dependency of a dependency?
      Sujan on HN

Alternatives named

  • pnpm hooks and overrides

    From 2 comments
    • Leaving aside the comedic factor, albeit problem-solving, if you want a sane alternative check out pnpm. It will not only make the installation of deps faster but it will also…
      andreineculau on HN
    • Actually, I have written an article about this when the feature was added to pnpm: Why package managers need hook systems…
      zkochan on HN
  • Yarn resolutions field

    From 1 comment
    • That’s an interesting approach to it (modifying how the package.json is processed). If anyone is wondering if their current package manager supports this, it does if you are…
      exogen on HN
  • diff and patch, or npm pack tarballs

    From 2 comments
    • We had same issue and we used diff and patch.
      nautical on HN
    • A safer way in my opinion is to: 0. read module license 1. checkout the module to be patched 2. modify it 3. do "npm pack" to save a tarball 4. set the dependency version in your…
      partycoder on HN
  • Forking dependencies via git references

    From 1 comment
    • One of the really nice things about NPM (and other modern source-level dependency managers) is that it's trivial to fork dependencies and reference commits in remote Git…
      Benjamin_Dobell on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/15718337)