cypress: Support Bun: Running Bun Install in Docker gives The Cypress App could not be downloaded

Current behavior

Setting up a Dockerfile, when running install it fails to download Cypress and I don’t quite understand why, seems like a Cypress issue

=> ERROR [install 4/8] RUN cd /temp/dev && bun install --frozen-lockfile                                                                             10.8s
------
 > [install 4/8] RUN cd /temp/dev && bun install --frozen-lockfile:
0.204 bun install v1.0.22 (b400b36c)
0.228 [21.66ms] migrated lockfile from package-lock.json
0.238  Saved lockfile
10.57 Installing Cypress (version: 12.8.1)
10.57 
10.57 [STARTED] Task without title.
10.57 [TITLE]  Downloading Cypress      0% 0s
10.57 [TITLE]  Downloading Cypress      1% 11s
10.57 [TITLE]  Downloading Cypress      1% 21s
10.57 [TITLE]  Downloading Cypress      2% 15s
10.57 [TITLE]  Downloading Cypress      4% 10s
10.57 [TITLE]  Downloading Cypress      5% 10s
10.57 [TITLE]  Downloading Cypress      6% 10s
10.57 [TITLE]  Downloading Cypress      7% 10s
10.57 [TITLE]  Downloading Cypress      8% 9s
10.57 [TITLE]  Downloading Cypress      10% 8s
10.57 [TITLE]  Downloading Cypress      11% 8s
10.57 [TITLE]  Downloading Cypress      13% 8s
10.57 [TITLE]  Downloading Cypress      14% 8s
10.57 [TITLE]  Downloading Cypress      16% 7s
10.57 [TITLE]  Downloading Cypress      18% 7s
10.57 [TITLE]  Downloading Cypress      20% 6s
10.57 [TITLE]  Downloading Cypress      22% 6s
10.57 [TITLE]  Downloading Cypress      24% 5s
10.57 [TITLE]  Downloading Cypress      26% 5s
10.57 [TITLE]  Downloading Cypress      28% 5s
10.57 [TITLE]  Downloading Cypress      30% 5s
10.57 [TITLE]  Downloading Cypress      32% 5s
10.57 [TITLE]  Downloading Cypress      34% 4s
10.57 [TITLE]  Downloading Cypress      36% 4s
10.57 [TITLE]  Downloading Cypress      37% 4s
10.57 [TITLE]  Downloading Cypress      39% 4s
10.57 [TITLE]  Downloading Cypress      41% 4s
10.57 [TITLE]  Downloading Cypress      43% 4s
10.57 [TITLE]  Downloading Cypress      46% 3s
10.57 [TITLE]  Downloading Cypress      47% 3s
10.57 [TITLE]  Downloading Cypress      49% 3s
10.57 [TITLE]  Downloading Cypress      50% 3s
10.57 [TITLE]  Downloading Cypress      52% 3s
10.57 [TITLE]  Downloading Cypress      54% 3s
10.57 [TITLE]  Downloading Cypress      57% 3s
10.57 [TITLE]  Downloading Cypress      59% 2s
10.57 [TITLE]  Downloading Cypress      60% 2s
10.57 [TITLE]  Downloading Cypress      62% 2s
10.57 [TITLE]  Downloading Cypress      65% 2s
10.57 [TITLE]  Downloading Cypress      67% 2s
10.57 [TITLE]  Downloading Cypress      68% 2s
10.57 [TITLE]  Downloading Cypress      70% 2s
10.57 [TITLE]  Downloading Cypress      71% 2s
10.57 [TITLE]  Downloading Cypress      73% 2s
10.57 [TITLE]  Downloading Cypress      74% 2s
10.57 [TITLE]  Downloading Cypress      75% 2s
10.57 [TITLE]  Downloading Cypress      76% 1s
10.57 [TITLE]  Downloading Cypress      77% 1s
10.57 [TITLE]  Downloading Cypress      79% 1s
10.57 [TITLE]  Downloading Cypress      81% 1s
10.57 [TITLE]  Downloading Cypress      83% 1s
10.57 [TITLE]  Downloading Cypress      85% 1s
10.57 [TITLE]  Downloading Cypress      86% 1s
10.57 [TITLE]  Downloading Cypress      89% 1s
10.57 [TITLE]  Downloading Cypress      91% 1s
10.57 [TITLE]  Downloading Cypress      92% 0s
10.57 [TITLE]  Downloading Cypress      94% 0s
10.57 [TITLE]  Downloading Cypress      96% 0s
10.57 [TITLE]  Downloading Cypress      97% 0s
10.57 [TITLE]  Downloading Cypress      98% 0s
10.57 The Cypress App could not be downloaded.
10.57 
10.57 Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
10.57 
10.57 Otherwise, please check network connectivity and try again:
10.57 
10.57 ----------
10.57 
10.57 URL: https://download.cypress.io/desktop/12.8.1?platform=linux&arch=x64
10.57 TypeError: undefined is not an object
10.57 
10.57 ----------

Desired behavior

bun install --frozen-lockfile should install

Test code to reproduce

I’m attempting to build a Dockerfile for Invoice Ninja, and this is the relevant code

FROM oven/bun:latest as base
WORKDIR /app
# Install dependencies into temp directory
# This will cache them and speed up future builds
FROM base as install
RUN mkdir -p /temp/dev
RUN bun upgrade
COPY package.json package-lock.json /temp/dev/
# Install with dev for build
RUN cd /temp/dev && bun install --frozen-lockfile

with the following for Cypress in the package.json

"cypress": "^12.5.1",

Cypress Version

12.8.1 was attempted install

Node version

Bun 1.0.22

Operating System

Docker

Debug Logs

No response

Other

No response

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 1
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@ZachHandley

I used cypress/factory to build a Docker image and run Cypress using Bun.

Dockerfile contents:

ARG NODE_VERSION='20.11.0'

FROM cypress/factory
RUN npm install bun --global

COPY . /opt/app
WORKDIR /opt/app
RUN bun add cypress -D

It is not very elegant to have to use Node.js in parallel to Bun, and to install Bun with npm. This was just to show that it is possible. There is no claim that it is an optimal solution!

docker build . -t test
docker run -it test bun cypress run

The Bun / Node.js compatibility page says:

Bun aims for complete Node.js API compatibility. Most npm packages intended for Node.js environments will work with Bun out of the box; the best way to know for certain is to try it.

This page is updated regularly to reflect compatibility status of the latest version of Bun. The information below reflects Bun’s compatibility with Node.js v20. If you run into any bugs with a particular package, please open an issue. Opening issues for compatibility bugs helps us prioritize what to work on next.

I don’t normally use Bun, so I wouldn’t want to open a Bun issue. Perhaps somebody who is interested in using Cypress with Bun could open a Bun issue, so that the compatibility is looked at? In the meantime you will need to have Node.js installed.

Edit: I didn’t see any Bun user reporting the compatibility issue with the Cypress postinstallation script, and since I had already done the work to reproduce the issue, I decided after all to report it to Bun myself.

The comment (above) that Node.js is required still stands.

So my only issue with this is that Bun is meant to be a direct replacement of NPM. It quite literally works as a drop in replacement for me everywhere I go. Is there a specific thing that’s causing this in Cypress? Bun has replacement features for almost everything, and it has node webserver and such built in, so can there be compatibility added? I’d be happy to peek at it.

Adding a note to the docs about Node.js being required: https://github.com/cypress-io/cypress-documentation/pull/5615

@ZachHandley

The Docker image oven/bun does not include Node.js and this is required for a successful download of Cypress.

The documentation Installing Cypress > System requirements > Node.js implies this, although it is not specific to say that one of npm, Yarn or pnpm is required.

I can also reproduce this on Ubuntu with only Bun and no Node.js installed.

So the issue is that Cypress cannot be installed without Node.js. This would be a separate enhancement request to allow Cypress to be installed and run in a pure Bun environment with no Node.js present. It’s also possible that this issue is a Bun bug, since Bun is advertised as a drop-in replacement for Node.js. Edit: The Bun / Node.js compatibility page shows multiple gaps in Bun’s compatibility with Node.js.

Another enhancement request would be for Cypress Docker images to allow use with Bun.

@ZachHandley

  • This is similar to issue https://github.com/cypress-io/cypress/issues/27997 where network security may be causing an issue in downloading Cypress. Edit: not relevant.

  • Note that there is no mention in the Cypress documentation that Bun is a supported environment. See System requirements. There was a request for Bun support in https://github.com/cypress-io/github-action/issues/585 for the Cypress GitHub Action. I haven’t seen any request or plan for the core Cypress product to support Bun so far.

  • You may want to test installing using npm instead. If it’s a network security issue then I would expect you to see the same error.