-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change DEB nodejs relation from Depends to Recommends #916
Conversation
A "Recommends" relation preserves the out-of-the-box experience for most people, as recommended packages are installed by default on modern Debian / Ubuntu distros. But it allows people who install Node.js in a different manner to opt out of the nodejs DEB package.
I was worried about the out-of-the-box experience. Ideally we don't want people that use Yarn to even have to know what Node.js is, it should "just work". If Debian and Ubuntu automatically install recommended dependencies then I think this is fine. One issue I can think of is with Ubuntu 14.04. The Node.js version in its repository is too old (0.10.x), so installation of Yarn fails until you add a repository that has a newer version of Node.js (such as NodeSource's). With the change in this PR, I'm worried that Yarn will install with no problems, as the Node.js requirement is no longer a hard dependency. Is that what will happen?
Does Ubuntu 14.04 do this too? It's old but there's still quite a few people using it. Could you please test it on a fresh Ubuntu VM or VPS that does not have Node.js installed and verify that it installs Node.js? You can clone our Debian repo from https://github.com/yarnpkg/releases, add your package with
How do you opt-out from installing the recommended packages? |
By passing the
Yes, it is true on Ubuntu 14.04 as well. Here is an easier way to test it: Compare the output of these two commands:
and
You are right, I think. But this should be solvable by other means. Here are two options that come to mind:
|
(ref nodejs/docker-node#243 for posterity) |
Thank you for the information! I'll do some more testing across a few different Ubuntu/Debian versions and see how it goes. Should we also do this change for the CentOS RPM? It also has a dependency on |
Not sure really, I don't have much experience with RPM. If its notion of
Thanks! |
Can I run Yarn without having nodejs? If not, then nodejs is a dependency for Yarn. I just checked how other Debian packages are doing it, such as node-ws and npm. They all list nodejs in Depends. If you install Nodejs in some other way than through Apt you essentially tell the system that you don't want their dependency-resolving package manager. Faking the dependencies of the Yarn to circumvent that is not the right way to go. If you installed Nodejs by some other means than through Apt, I suggest that you create a meta-package to tell that to Apt. Check out equivs which was built to do just that. Another solution is to create a real |
@emilv those packages (npm, node-ws) are 3 years old now. not the best role models to work with. I don't think a single person installs npm using apt from distro repos. node itself does not recommend these ancient packages. yarn deb package should provide a convenient way to install it. Telling people to create meta packages would not serve that purpose. |
They are perfect role models for how a package made for the Apt package manager are supposed to be. Wouldn't it be crazy if an Npm package didn't use semantic versioning? This is no different. It's crazy to not specify a hard dependency in the Depends field. |
@emilv I think I could not express myself properly. The
|
@Daniel15 well it would refuse to install, which is not necessarily a total failure in this case :)
My preference is slightly towards yes, but I admit it might be a regression in certain scenarios. If it leads to converting Yarn into a shell script in order to have a nicer error message when a compatible Node can't be auto-installed, then it's probably not worth the trouble. But on second thought, it's not very likely that someone would attempt to install Yarn without having Node already installed somehow. A slightly better variation of the current PR would be replacing the current
with
This would have the advantage of refusing to install on Ubuntu 14.04 if only the distro-provided |
Well, Yarn is aiming to be reasonably language-agnostic (notice the home page doesn't mention JavaScript at all), so eventually we'll have users that have never used Node.js before (and some that don't really care about Node.js, much like most of us don't really care about glibc or the MSVC runtime or any other runtime dependencies of apps we use every day.
It'll still install with no errors if they don't have Node.js installed at all, but I guess that's fine. Add the |
@Daniel15 done, PR updated. Tested the result on Ubuntu 14.04 and 16.04 and it works as expected. |
Thank you! This helped me learn a bit more about dpkg 😄 |
FYI, I had to change |
Thanks. I somehow missed that (as Lintian is also throwing other warnings). |
Lintian should only have two other errors right now, both due to third-party code:
There's quite a few other warnings that are ignored though, but they shouldn't appear when you run lintian. |
* Change DEB nodejs relation from Depends to Recommends A "Recommends" relation preserves the out-of-the-box experience for most people, as recommended packages are installed by default on modern Debian / Ubuntu distros. But it allows people who install Node.js in a different manner to opt out of the nodejs DEB package. * Add "Conflicts" relationship with DEB nodejs < 4.0.0
Pushed to the package repository as version |
@eknkc - Just noticed this comment:
Ubuntu has a newer version, 3.5.2: http://packages.ubuntu.com/xenial/npm. This also depends on nodejs rather than just recommending or suggesting it. |
Summary
A "Recommends" relation preserves the out-of-the-box experience for most people, as recommended packages are installed by default on modern Debian / Ubuntu distros. But it allows people who install Node.js using a different method to opt out of the nodejs DEB package.
Test plan
$ bash scripts/build-deb.sh
...
$ sudo dpkg -i artifacts/yarn_0.15.1_all.deb
^ the above commands execute successfully.