Skip to content
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

Missing dependencies? #20

Closed
mindplay-dk opened this issue Dec 14, 2019 · 8 comments
Closed

Missing dependencies? #20

mindplay-dk opened this issue Dec 14, 2019 · 8 comments
Labels

Comments

@mindplay-dk
Copy link

I'm trying to use this package with karma and mocha.

My karma.conf.js looks something like this:

process.env.CHROMIUM_BIN = require('chromium').path

module.exports = function(config) {
  config.set({
    // ...
    frameworks: ['mocha'],
    browsers: ['ChromiumHeadless'],
    // ...
  });
};

Now, karma start karma.conf.js gets me as far as attempting to launch, but emit this error:

> karma start karma.conf.js --single-run

14 12 2019 13:54:05.151:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
14 12 2019 13:54:05.155:INFO [launcher]: Launching browsers ChromiumHeadless with concurrency unlimited
14 12 2019 13:54:05.164:INFO [launcher]: Starting browser ChromiumHeadless
14 12 2019 13:54:05.190:ERROR [launcher]: Cannot start ChromiumHeadless
        /mnt/c/workspace/fre/node_modules/chromium/lib/chromium/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

Looks like there's a dependency on some shared binary libX11-xcb.so.1, but looks like this wasn't installed - so I'm guessing there's a missing/undeclared dependency on the package that provides this binary?

I could probably figure out what package that is, and install it manually, but is that really "how it's done"? I'm not very Linux savvy, but I thought the package manager was supposed to install whatever is needed.

If not, how would I get a repeatable build on a CI server? How are contributors supposed to get a working build on their local systems?

My apologies in advance if I'm asking dumb questions - this is my first attempt at automating a headless browser for a test-suite. That is the purpose of this package, right? 😊

@mindplay-dk
Copy link
Author

For the record, I've also tried with the puppeteer package, and it fails with the same error message - and people seem to accept the solution that all dependencies have to be manually installed, so I don't know... maybe there's no such thing as an npm installable working Chrom(e|ium) environment? 🤷‍♂️

@dtolstyi
Copy link
Owner

For me it looks like a problem with X server. Have you tried one of dozens solutions for this problem mentioned in Google? E.g. this one: https://medium.com/@cloverinks/how-to-fix-puppetteer-error-ibx11-xcb-so-1-on-ubuntu-152c336368

@dtolstyi
Copy link
Owner

dtolstyi commented Dec 22, 2019

I'm not sure about your server installation but it's possible that X is not installed at all. So, it's a server issue rather than library IMO.
You may try to install chromium manually and see if it works or no (like this you will be able to check if the issue is with your system or this package)

@mindplay-dk
Copy link
Author

@dtolstyi yes, of course I can manually install all the dependencies with the system's package manager. My point is, that's not a very good solution - the whole point of using a package manager is so you don't need to manually install dependencies, or (worse, as in this case) can't even tell what's missing or why.

This is not a critique of this package, nor of Chromium. You could say this is a problem with npm being ignorant of the system dependencies of packages. Or you could say this a problem with node itself exposing system dependencies without providing any means of managing them. I guess I'm starting to see why a few projects (such as this one) have tried to create universal package managers.

Short of something like that, I don't suppose this problem is solvable.

@dtolstyi
Copy link
Owner

I see what you mean @mindplay-dk. Unfortunately, it's very hard and, probably, not needed operation: to install all required dependencies by the package manager. The problem here is that you will have to manage all versions of dependencies somehow. Let's say you need to install both packages A and B that require dependency C but of different versions: X and Y. What version should be chosen during installation? What will happen if you install manually version Z of dependency C?
For me it looks way too complicated...

@mindplay-dk
Copy link
Author

Let's say you need to install both packages A and B that require dependency C but of different versions: X and Y. What version should be chosen during installation?

Well, both - in separate locations.

Of course, this isn't possible with package managers that only manage dependencies globally, which is why I hate relying on shared system-wide dependencies in the first place.

Anyhow, I've derailed the discussion into complete hypothesis at this point, since the reality is that your OS package manager does globally install everything, and apps (such as Chrome) do get built with dependencies on globally installed libraries... I only wish it wasn't like this.

@dtolstyi
Copy link
Owner

I do understand you Rasmus. It looks to me like virtual machines or containers. Maybe, this is what you are looking for?

@mindplay-dk
Copy link
Author

I do understand you Rasmus. It looks to me like virtual machines or containers. Maybe, this is what you are looking for?

Heh, we're complete off-topic now, but no - honestly, I view containers as being mostly a work-around for the same problem: "even package managers don't work, so let's just package the entire OS and virtualize everything", I wonder if that wasn't largely the original motivation for the idea of containers?

For the most part, I just wish projects would ship self-contained binaries - statically linked with no dependencies beyond the system kernel and drivers. It's not like that isn't possible - a few projects do it. I think what I'm really looking for is a change in culture. 🤷‍♂️

Anyhow, I digress. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants