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

Need help overriding node version 18.16.1 #467

Closed
delusioninabox opened this issue Apr 16, 2024 · 10 comments
Closed

Need help overriding node version 18.16.1 #467

delusioninabox opened this issue Apr 16, 2024 · 10 comments

Comments

@delusioninabox
Copy link

Cypress is installing all my NPM packages by default with node version 18.16.1. Because of the older version, some of our packages appear to be installing older versions despite being newer versions in our package-lock file. We have a few tests that are flaky in circleci but run reliably locally, and I think they might be related, so I want our Cypress tests in circleci to run on a newer version to see if that resolves some of that inconsistency.

I have tried following the steps in the documentation and alternative configurations, but it runs on 18.16.1 every time regardless. Our setup is also set to work with circleci's "rerun failed tests" and following that documentation, if that matters. I tried different cypress/browsers for the image and had the same result.

version: 2.1
orbs:
  cypress: cypress-io/cypress@3

executor:
  docker:
    - image: cypress/browsers:node-20.12.0-chrome-123.0.6312.86-1-ff-124.0.2-edge-123.0.2420.65-1

workflows:
  build-deploy:
    jobs:
      - cypress/run:
          parallelism: 10
          start-command: 'npm start'
          cypress-command: |
            mkdir test_results
            npx wait-on http://localhost:3001
            circleci tests glob "cypress/e2e/**/*.cy.ts" |
            circleci tests run --command="xargs npx cypress run --reporter cypress-circleci-reporter --spec" --split-by=timings --verbose
          post-steps:
            - store_test_results:
                path: test_results

Can someone help spot what I'm missing to get this running on a different node version than the default?

@jennifer-shehane
Copy link
Member

@delusioninabox Could you share some of the output that shows Node 18.16.1 being used?

@delusioninabox
Copy link
Author

@jennifer-shehane Of course!

The spin up environment step:

Build-agent version 1.0.234836-59bdf2c3 (2024-04-15T14:48:32+0000).
System information:
 Server Version: 24.0.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Kernel Version: 5.15.0-1053-aws
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64

Starting container cimg/node:18.16.1-browsers
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image cache not found on this host, downloading cimg/node:18.16.1-browsers
18.16.1-browsers: Pulling from cimg/node
2ab09b027e7f: Already exists 
7b8664c77e57: Already exists 
217f1150b17c: Already exists 
b67a6a85b221: Already exists 
0f829e38bde7: Already exists 
44a002a96bdc: Already exists 
5546d74a5479: Already exists 
4f4fb700ef54: Already exists 
613613a13e99: Already exists 
6250e3504854: Already exists 
4f550f5c419d: Already exists 
1792f3d5cbfa: Pull complete 
2e3101443624: Pull complete 
84508b676d07: Pull complete 
Digest: sha256:49903b71aac206cdc489648589909f480a24f178d3274a2979686377f7fbf88c
Status: Downloaded newer image for cimg/node:18.16.1-browsers
cimg/node:18.16.1-browsers:
  using image cimg/node@sha256:49903b71aac206cdc489648589909f480a24f178d3274a2979686377f7fbf88c
  pull stats: download 173.3MiB in 1.754s (98.74MiB/s), extract 173.3MiB in 5.22s (33.19MiB/s)
  time to create container: 3.473s
Time to upload agent and config: 430.218157ms
Time to start containers: 243.35086ms

At the start of the installing NPM packages step:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package '<<removed>>'
npm WARN EBADENGINE   required: { node: '21.5.0', npm: '10.2.5' },
npm WARN EBADENGINE   current: { node: 'v18.16.1', npm: '9.5.1' }
npm WARN EBADENGINE }

@MikeMcC399
Copy link
Collaborator

@delusioninabox

A working example on https://github.com/cypress-io/cypress-realworld-app/blob/develop/.circleci/config.yml is using executors: instead of executor:. Does that make any difference if you try that out on your workflow?

version: 2.1
orbs:
  cypress: cypress-io/cypress@3.3.1
  codecov: codecov/codecov@1.2.3 #

executors:
  with-chrome-and-firefox:
    docker:
      - image: "cypress/browsers:node-20.12.0-chrome-123.0.6312.86-1-ff-124.0.2-edge-123.0.2420.65-1"
    resource_class: large
    environment:
      CYPRESS_coverage: false

@delusioninabox
Copy link
Author

Yes, I initially tried with executors and it didn't work. 😔

executors:
  default:
    docker:
      - image: cypress/browsers:node-20.12.0-chrome-123.0.6312.86-1-ff-124.0.2-edge-123.0.2420.65-1

@MikeMcC399
Copy link
Collaborator

@TooColline
Copy link

@MikeMcC399 Yeah that works, although it would be nice to have the option for cypress/run as well

@MikeMcC399
Copy link
Collaborator

@TooColline

Yeah that works, although it would be nice to have the option for cypress/run as well

Agreed! I added some comment into #468 (comment) about this.

@delusioninabox
Copy link
Author

Thanks y'all! Agreed that an option for cypress/run would be fantastic. 💯

@MikeMcC399
Copy link
Collaborator

@TooColline / @delusioninabox

Thanks y'all! Agreed that an option for cypress/run would be fantastic. 💯

@MikeMcC399
Copy link
Collaborator

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

No branches or pull requests

4 participants