Reputation: 534
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?
Upvotes: 1
Views: 1227
Reputation: 534
I think I was looking for an explicit statement from nodejs or npmjs about the "pinning" of an npm
version to a node
version/release.
Barring an explicit statement, I could read between the lines on npmjs: the pinning is simply a convenience for the user.
Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
It then proceeds to tell the reader, run npm install npm@latest -g
.
Test: Run
npm -v
. The version should be higher than 2.1.8.
Simply put, installing node
gives you a version of npm
at the time of the node
release. npmjs suggests updating npm
at your convenience.
So running node
v6.10.10 with npm
v4.1.2 should not be a problem. At least not a documented problem.
Upvotes: 3