ENOENT: no such file or directory error in Cypress

578 views Asked by At

When running Cypress using GUI, I'm getting this error:

Error: ENOENT: no such file or directory, stat '/home/user/.config/Cypress/cy/production/projects/testProject-ba4506b83588731a9b974658caac8b40/bundles/cypress/e2e/01-test-details.feature'

When running using CLI, I get this error:

Running: 01-test-details.feature (1 of 8)

Oops...we found an error preparing this test file:

cypress/e2e/01-test-details.feature

The error was:

Error: Build failed with 14 errors:

cypress/support/step-definitions/01-01-test-details.hooks.ts:1:30: ERROR: Could not resolve "@badeball/cypress-cucumber-preprocessor" cypress/support/step-definitions/01-test-details.steps.ts:1:21: ERROR: Could not resolve "@badeball/cypress-cucumber-preprocessor" cypress/support/utilities/date-util.ts:1:19: ERROR: Could not resolve "moment" ... at failureErrorWithLog (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:1650:15) at /home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:1059:25 at runOnEndCallbacks (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:1485:45) at buildResponseToResult (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:1057:7) at /home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:1086:16 at responseCallbacks. (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:703:9) at handleIncomingPacket (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:763:9) at Socket.readFromStdout (/home/user/project/Cypress_Project/testProject/node_modules/esbuild/lib/main.js:679:7) at Socket.emit (node:events:519:28) at Socket.emit (node:domain:488:12) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Socket.Readable.push (node:internal/streams/readable:390:5) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

  • A missing file or dependency
  • A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.

But these packages are installed properly. But this project location doesn't contain a bundles folder.

/home/user/.config/Cypress/cy/production/projects/testProject-ba4506b83588731a9b974658caac8b40

Node Version: v21.2.0

Ubuntu Version: Ubuntu 22.04.3 LTS

Yarn version: 1.22.19

Cypress Version: ^13.5.1

1

There are 1 answers

1
Atul KS On

When respective test file was selected to be run in the cypress runner, it popped the same message- "Error: ENOENT: no such file or directory".

Please refer to the PROBLEMS tab of your IDE (VS Code), it has the problem and line number for you to investigate. Refer image attached.

PROBLEMS tab of your IDE (VS Code)