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.

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.

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

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_RUN_BINARY=${pkgs.cypress}/bin/Cypress

It works perfectly … I love NixOS !

1 Like