How to install chromium?

Hi there

I’m trying to use percy.io SDK and google lighthouse npm library. Both of them use chromium.

I added chromium to the replit.nix file, but it is not enough. I’m missing lots of the dependencies chromium needs.

What could I do?

Thanks

Did you set guessImports in the .replit file to false? Usually, it should install those dependencies automatically if it is true

Otherwise, you may have to install the dependencies manually

1 Like

Show hidden files, go to your .replit file and add these two packages under deps

pkgs.chromium
pkgs.chromedriver

That’s what I use to install chromium for selenium.

My full .replit file (python so another language will be slightly different) looks like this:

{ pkgs }: {
  deps = [
    pkgs.python38Full
	pkgs.chromium
	pkgs.chromedriver
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python38Full}/bin/python3.8";
    LANG = "en_US.UTF-8";
  };
}
3 Likes

Hi Praquron,

I do have guessImports = true. I’m not calling the libraries through code but through the command line:

npx percy exec – python3 main.py
npx lighthouse https://google.com

Both gave me an error because they couldn’t load chromium and/or chromium dependencies.

Any idea?

Thanks

Hi InvisibleOne,

I do have those packages. I even activated unfree packages and imported pkgs.google-chrome to no avail.

I’m not using selenium, but calling the commands directly in the command line:

npx percy exec – python3 main.py
npx lighthouse https://ask.replit.com

Both gave me an error because they couldn’t load chromium and/or chromium dependencies.

Any idea?

Thanks

Hmm, does the npx lighthouse command have any flags to specify where the chromium packages are located? I’m not familiar with those tools