badeball / cypress-cucumber-preprocessor

Run cucumber/gherkin-syntaxed specs with Cypress
MIT License
1.32k stars 147 forks source link

error: [Circular *1] esbuild/install.js #1165

Closed alastair-todd closed 7 months ago

alastair-todd commented 7 months ago

Trying to pull my repo packages and node up, but getting this in ci/cd

Docker:

FROM cypress/base:20.10.0

WORKDIR /usr/src/app
COPY ./package*.json ./

RUN npm install
 > [4/4] RUN npm install:
#0 5.466 npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
#0 5.601 npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
#0 13.76 npm ERR! code 1
#0 13.76 npm ERR! path /usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild
#0 13.76 npm ERR! command failed
#0 13.76 npm ERR! command sh -c node install.js
#0 13.76 npm ERR! node:internal/errors:563
#0 13.76 npm ERR!     ErrorCaptureStackTrace(err);
#0 13.76 npm ERR!     ^
#0 13.76 npm ERR! 
#0 13.76 npm ERR! <ref *1> Error: spawnSync /usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/bin/esbuild ETXTBSY
#0 13.76 npm ERR!     at Object.spawnSync (node:internal/child_process:1124:20)
#0 13.76 npm ERR!     at spawnSync (node:child_process:876:24)
#0 13.76 npm ERR!     at Object.execFileSync (node:child_process:919:15)
#0 13.76 npm ERR!     at validateBinaryVersion (/usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/install.js:99:28)
#0 13.76 npm ERR!     at /usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/install.js:286:5 {
#0 13.76 npm ERR!   errno: -26,
#0 13.76 npm ERR!   code: 'ETXTBSY',
#0 13.76 npm ERR!   syscall: 'spawnSync /usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/bin/esbuild',
#0 13.76 npm ERR!   path: '/usr/src/app/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/bin/esbuild',
#0 13.76 npm ERR!   spawnargs: [ '--version' ],
#0 13.76 npm ERR!   error: [Circular *1],
#0 13.76 npm ERR!   status: null,
#0 13.76 npm ERR!   signal: null,
#0 13.76 npm ERR!   output: null,
#0 13.76 npm ERR!   pid: 0,
#0 13.76 npm ERR!   stdout: null,
#0 13.76 npm ERR!   stderr: null
#0 13.76 npm ERR! }
#0 13.76 npm ERR! 
#0 13.76 npm ERR! Node.js v20.10.0
#0 13.76 
#0 13.76 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-02-27T12_20_46_061Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm install]: exit code: 1

Dependencies:


"dependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^20.0.1",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
    "@cucumber/cucumber": "^10.3.1",
    "@cucumber/messages": "^24.0.1",
    "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
    "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
    "@types/fs-extra": "^11.0.4",
    "@types/luxon": "^3.4.2",
    "@types/node": "^20.11.10",
    "aws-amplify": "^6.0.13",
    "casual-browserify": "^1.5.19-2",
    "chance": "^1.1.11",
    "concurrently": "^8.2.2",
    "cy": "^0.0.1",
    "cy-verify-downloads": "^0.2.3",
    "cypress": "^13.6.3",
    "cypress-downloadfile": "^1.2.3",
    "cypress-file-upload": "^5.0.8",
    "cypress-image-diff-js": "^1.30.1",
    "cypress-plugin-tab": "^1.0.5",
    "cypress-terminal-report": "^5.3.12",
    "cypress-wait-until": "^3.0.1",
    "del-cli": "^5.1.0",
    "events": "^3.3.0",
    "fs-extra": "^11.2.0",
    "jszip": "^3.10.1",
    "luxon": "^3.4.4",
    "moment": "^2.30.1",
    "qs": "^6.11.2",
    "resolve": "^1.22.8",
    "typescript": "^5.3.3"
  }

cypress config

import { defineConfig } from 'cypress'; import createBundler from '@bahmutov/cypress-esbuild-preprocessor'; import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'; import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild';

...

async setupNodeEvents(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): Promise<Cypress.PluginConfigOptions> {
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // otherwise, remotes with self-signed certificates are rejected.

  // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
  await addCucumberPreprocessorPlugin(on, config);

  const bundler = createBundler({
    plugins: [
      NodeModulesPolyfills(),
      GlobalsPolyfills({
        process: true,
        buffer: true
      }),
      createEsbuildPlugin(config)
    ]
  });

  on('file:preprocessor', bundler);
badeball commented 7 months ago

This is related to esbuild, see eg. https://github.com/evanw/esbuild/issues/3156.