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

question: why might I get an ENOENT error when first starting up Cypress? #3

Closed
floifydaniel opened this issue Aug 12, 2022 · 3 comments

Comments

@floifydaniel
Copy link

floifydaniel commented Aug 12, 2022

When I first open Cypress to test, I see an error on the page: Error: ENOENT: no such file or directory, unlink '<rest of absolute path>/packages/my-pkg/vite.config.ts.mjs'. This also fails my CI pipeline sometimes and I'm wondering how to go about fixing it.. Enabling DEBUG=cypress:* shows the following logs:

cypress:server:controllers:spec preprocessor error for spec 'cypress/e2e/1-getting-started/todo.cy.js': Error: ENOENT: no such file or directory, unlink '/home/runner/work/floify-web-app/floify-web-app/packages/borrower-portal/vite.config.ts.mjs'
    at Object.unlinkSync (node:fs:1718:3)
    at loadConfigFromBundledFile (file:///home/runner/work/floify-web-app/floify-web-app/node_modules/vite/dist/node/chunks/dep-1513d487.js:62806:18)
    at async loadConfigFromFile (file:///home/runner/work/floify-web-app/floify-web-app/node_modules/vite/dist/node/chunks/dep-1513d487.js:62692:28)
    at async resolveConfig (file:///home/runner/work/floify-web-app/floify-web-app/node_modules/vite/dist/node/chunks/dep-1513d487.js:62344:28)
    at async doBuild (file:///home/runner/work/floify-web-app/floify-web-app/node_modules/vite/dist/node/chunks/dep-1513d487.js:43308:20)
    at async build (file:///home/runner/work/floify-web-app/floify-web-app/node_modules/vite/dist/node/chunks/dep-1513d487.js:43297:16)
    at async Object.handler (file:///home/runner/work/floify-web-app/floify-web-app/packages/borrower-portal/cypress.config.ts:64:25)
    at Object.wrapChildPromise (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:58:23)
    at Object.wrap (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/preprocessor.js:47:8)
    at RunPlugins.execute (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:152:29)
    at EventEmitter.<anonymous> (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:257:12)
    at EventEmitter.emit (node:events:390:28)
    at EventEmitter.emit (node:domain:[475](https://github.com/Floify/floify-web-app/runs/7812456026?check_suite_focus=true#step:4:476):12)
    at process.<anonymous> (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:390:28)
    at process.emit (node:domain:475:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:613:40)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
From previous event:
    at Object.getFile (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/packages/server/lib/plugins/preprocessor.js:100:65)
    at SocketE2E.watchTestFileByPath (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/packages/server/lib/socket-e2e.js:69:39)
    at Socket.<anonymous> (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/packages/server/lib/socket-e2e.js:79:26)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Socket.emitUntyped (/home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/runner/.cache/Cypress/10.3.1/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Locally, the error shows for a second or two then disappears but it's causing flake issues running in my CI environment. Any ideas on how to fix this? Thanks again for your time.

@floifydaniel
Copy link
Author

floifydaniel commented Aug 12, 2022

FWIW, if I copy the implementation from src/index.ts and put a try/catch around const watcher = await build(getConfig(defaultConfig)), it does not throw the error and my CI pipeline seems to be stable.

@mammadataei
Copy link
Owner

Hi, I don't understand why it might try watching the vite.config.ts file. Can you help me with a reproduction?

@floifydaniel
Copy link
Author

This appears to have been an issue with how Vite bundles config files in v3.0.0 and has been resolved (assumingly) with vitejs/vite#9121. Upgrading to v3.0.7 resolves this issue.

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

No branches or pull requests

2 participants