nodesource / distributions

NodeSource Node.js Binary Distributions

Home Page:https://nodesource.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ubuntu 18.04 installs 8.x from main repos instead of 6.x from nodesource

chrisportela opened this issue · comments

When I setup the 6.x nodesource repo it installs the 8.x "latest" from the main repos. While not a huge problem, I expected nodesource's node which includes npm.

I can't install node 6.x without specifying the version, which isn't horrible (I'm using salt and it's easy), but it's not what I expected.

If you add the following to your /etc/apt/preferences file you can prioritize whatever nodesource repos you have setup over the existing main ubuntu ones

Package: *
Pin: origin deb.nodesource.com
Pin-Priority: 600

Verify it's picking the right nodejs by using apt-cache policy nodejs.

If you already have a newer version installed from the Ubuntu repo apt-get remove it first and then just try to apt-get install nodejs.

Yeah, there's really no way around that, that's just how apt works. We actually didn't mean to ever make 6.x packages for 18.04 but it looks like we did by accident. The pinning solution @0xCMP recommends is the best way to handle this that I know of.

Two minor suggestions: Limit the pinning to the nodejs package and create a separate file.

For example, in /etc/apt/preferences.d/nodesource:

Package: nodejs
Pin: origin deb.nodesource.com
Pin-Priority: 600

I’ve also opened pull request #684 to add an FAQ entry regarding this issue.