badeball / cypress-cucumber-preprocessor

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

Error on node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js: #1197

Closed benoit-parmentier-2 closed 3 months ago

benoit-parmentier-2 commented 3 months ago

Hello :)

I've been struggling with this error for several hours !

Thanks for your feedback

Benoît

Current behavior

I encounter an ENOT error in the cypress console.

Capture d’écran 2024-06-10 à 13 56 04

I am also experiencing the below errors in terminal :

✘ [ERROR] Could not resolve "@cucumber/cucumber-expressions"

    node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js:7:39:
      7 │ ...cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
        ╵                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@cucumber/cucumber-expressions" here because it's not listed as a dependency of this package:

    ../../../.pnp.cjs:43:33:
      43 │           "packageDependencies": [\
         ╵                                  ~~

  You can mark the path "@cucumber/cucumber-expressions" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "@cucumber/tag-expressions"

    node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js:8:50:
      8 │ ...ressions_1 = __importDefault(require("@cucumber/tag-expressions"));
        ╵                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@cucumber/tag-expressions" here because it's not listed as a dependency of this package:

    ../../../.pnp.cjs:43:33:
      43 │           "packageDependencies": [\

Desired behavior

The cypress open command works without errors.

Test code to reproduce

https://github.com/benoit-parmentier-2/test-cypress

Versions

test-cypress@1.0.0 /Users/bparmentier/Devops/acceptance-tests/test-cypress
├── @badeball/cypress-cucumber-preprocessor@17.2.1
├── @bahmutov/cypress-esbuild-preprocessor@2.2.0
├── cucumber-html-reporter@7.1.1
├── cypress-commands@3.0.0
├── cypress-downloadfile@1.2.3
├── cypress-real-events@1.12.0
├── cypress@12.17.4
├── dotenv@16.4.5
└── soft-assert@0.2.7

Checklist

badeball commented 3 months ago

Does it work using npm?

benoit-parmentier-2 commented 3 months ago

Thank you for the super quick response.

Yes, I use npm.

➜  test-cypress git:(main) npm install
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 429 packages, and audited 430 packages in 5s

71 packages are looking for funding
  run `npm fund` for details

6 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
badeball commented 3 months ago

Then what’s up with the Yarn Plug'n'Play messages?

benoit-parmentier-2 commented 3 months ago

Very good question.

I deleted yarn from my laptop.

I relaunched npm install and still got the same error.

The logs are as follows :

➜  test-cypress git:(main) ✗ yarn
zsh: command not found: yarn
➜  test-cypress git:(main) ✗ ls
cypress           cypress.config.js node_modules      package-lock.json package.json
➜  test-cypress git:(main) ✗ rm package-lock.json
➜  test-cypress git:(main) ✗ npm install

up to date, audited 424 packages in 1s

80 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  test-cypress git:(main) ✗ ls
cypress           cypress.config.js node_modules      package-lock.json package.json
➜  test-cypress git:(main) ✗ sudo ./node_modules/.bin/cypress open
Password:

DevTools listening on ws://127.0.0.1:52559/devtools/browser/9e92eb83-9dea-44cb-868e-15abdb01be1f
2024-06-10 14:52:51.567 Cypress[30949:346328] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
GET /__/ 200 3.180 ms - -
GET /__/assets/index-3fd9e8ed.css 200 1.759 ms - -
GET /__/assets/polyfills-3023ae52.js 200 6.793 ms - -
GET /__/assets/index-20e7ba51.js 200 4.058 ms - -
GET /__cypress/runner/cypress_runner.css 200 1.957 ms - -
GET /__/assets/route-block-c0a8bdd8.js 200 4.572 ms - 45
GET /__/assets/Specs-8818f8cf.js 200 5.715 ms - 523
GET /__/assets/TrackedBanner.vue_vue_type_script_setup_true_lang-d18e12b6.js 200 7.802 ms - -
GET /__/assets/InlineCodeFragment-63f519c9.css 200 22.196 ms - 310
GET /__/assets/InlineCodeFragment.vue_vue_type_script_setup_true_lang-71633254.js 200 7.651 ms - -
GET /__/assets/Index-f90bad12.css 200 21.406 ms - -
GET /__/assets/box-open_x48-7e820d62.js 200 14.656 ms - -
GET /__/assets/graphql-b5978717.js 200 2.945 ms - 535
GET /__/assets/Index-5b33f553.js 200 7.930 ms - -
GET /__/assets/SpecPatterns.vue_vue_type_script_setup_true_lang-55ee591e.js 200 3.928 ms - -
GET /__/assets/SpecNameDisplay.vue_vue_type_script_setup_true_lang-a2616227.js 200 4.684 ms - -
GET /__/assets/PromoHeader.vue_vue_type_script_setup_true_lang-0afb3ac7.js 200 9.869 ms - -
GET /__/assets/settings_x16-584dc885.js 200 5.193 ms - -
GET /__/assets/cypress_s-29af549a.png 200 5.906 ms - 4425
GET /__/assets/chrome-98045c79.svg 200 3.651 ms - -
GET /__/assets/electron-fb07f5cc.svg 200 5.337 ms - -
GET /__cypress/runner/cypress_runner.js 200 2.378 ms - -
GET /chrome-variations/seed?osname=mac&channel=stable&milestone=125 304 2303.994 ms - -
GET /__/assets/Switch.vue_vue_type_script_setup_true_lang-6f344aa5.js 200 2.199 ms - -
GET /__/assets/refresh_x16-9b4cdb2e.js 200 2.151 ms - -
GET /__/assets/Runner-d26b5796.css 200 2.268 ms - -
GET /__/assets/Runner-4df2a388.js 200 3.757 ms - -
POST /ListAccounts?gpsia=1&source=ChromiumBrowser&json=standard 200 2366.956 ms - -
GET /__cypress/iframes/cypress%2Fe2e%2Ffeatures%2Fspec.feature?browserFamily=chromium 200 5.004 ms - -
ENOENT: no such file or directory, stat '/Users/bparmentier/Library/Application Support/Cypress/cy/production/projects/test-cypress-50ac88a36bd0c936fe9e28dbf1884d49/bundles/cypress/e2e/features/spec.feature'
GET /__cypress/tests?p=cypress/e2e/features/spec.feature 200 179.581 ms - 318
GET /__cypress/tests?p=cypress/support/e2e.js 200 183.898 ms - 15
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__/fonts/FiraCode-VF.woff2 - - ms - -
GET /__cypress/iframes/cypress%2Fe2e%2Ffeatures%2Fspec.feature?browserFamily=chromium 200 2.202 ms - -
GET /__cypress/tests?p=cypress/support/e2e.js 200 3.298 ms - 15
ENOENT: no such file or directory, stat '/Users/bparmentier/Library/Application Support/Cypress/cy/production/projects/test-cypress-50ac88a36bd0c936fe9e28dbf1884d49/bundles/cypress/e2e/features/spec.feature'
GET /__cypress/tests?p=cypress/e2e/features/spec.feature 200 3.830 ms - 318
✘ [ERROR] Could not resolve "@cucumber/cucumber-expressions"

    node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js:18:39:
      18 │ ...ucumber_expressions_1 = require("@cucumber/cucumber-expressions");
         ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@cucumber/cucumber-expressions" here because it's not listed as a dependency of this package:

    ../../.pnp.cjs:43:33:
      43 │           "packageDependencies": [\
         ╵                                  ~~

I can't explain this error with yarn.

badeball commented 3 months ago

Well, I don't get the same error using npm and I can't help you with yarn-specific errors.

benoit-parmentier-2 commented 3 months ago

I understand that you cannot inform me.

However, who do you think I can contact ? cypress ? yarn ?

badeball commented 3 months ago

However, who do you think I can contact ? cypress ? yarn ?

I don't think anyone else can help you with this.

Did you use yarn at some point? Did you not delete node_modules between switching?