Monday, 13 March 2017

Why does `node` pin versions of `npm` to each release?

Some questions and answers hint there is an answer, but I don't think I see an answer in the forest.

I turned to brew to move away from nvm due to how my IDE loads the $PATH from the launcher. It seemed that it would not find the installed version of node or npm from the .nvm directory. When loaded from /usr/local/bin the IDE worked fine. Add that brew has an nvm-lite feature with brew link --force [version].

However, what brew does not do is managed npm (at least very well). There is some discussion of this on the brew boards, but only that the suggestion that brew does not need to manage npm.

Thusly, brew install node gives me node 7.7.2 and npm 4.1.2. All good.

But brew unlink node && brew link node@6 gives me node 6.10.0 and leaves npm 4.1.2. Whereas nodejs.org suggests npm 3.10.10 is the version of npm one should use.

Now, if node pins a version of npm for a reason, and assuming a good reason, what is the reason? I can't find anything. No one is talking about this connection. It might be my Google Fu, but what I have found suggests that a) no one knows, or b) the version of npm you use doesn't matter. The reasoning for the latter seems dubious: why bother pinning a version of npm to node if it didn't matter?



via javafueled

No comments:

Post a Comment