Cypress with npm

Hello. What it the best way to work with Cypress on nixos which was installed with npm modules?
Here is error due to missing deps:


This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies

Please refer to the error below for more details.

----------

Command failed with ENOENT: /home/tim/.cache/Cypress/8.3.0/Cypress/Cypress --no-sandbox --smoke-test --ping=251
spawn /home/tim/.cache/Cypress/8.3.0/Cypress/Cypress ENOENT

----------

Platform: linux (NixOS - )
Cypress Version: 8.3.0
error Command failed with exit code 1.
i
3 Likes

Same issue here !

There are dependencies specified in the documentation but I’m not sure which one may be missing …

You need to set these environment variables before running cypress, e.g. in your shellHook

CYPRESS_INSTALL_BINARY=0
CYPRESS_RUN_BINARY=${cypress}/bin/Cypress
1 Like

Yes ! I’ve juste figured I need to use Nix’s Cypress instead of the one installed via npm …

I had it working with this default.nix :

{ pkgs ? import <nixos-unstable> {} }:
  pkgs.mkShell {
    nativeBuildInputs = with pkgs; [ nodejs-18_x cypress ];

    shellHook = ''
      export CYPRESS_INSTALL_BINARY=0
      export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
    '';
}

It works perfectly … I love NixOS !

1 Like