cypress: Webpack Compilation Error when upgrading to Cypress 13.1.0
Current behavior
Updated from Cypress 12.6.0 to 13.1.0 and started to get this error:
Oops...we found an error preparing this test file:
> cypress/support/e2e.js
The error was:
Error: Webpack Compilation Error
Module not found: Error: Can't resolve 'process/browser.js' in '/Users/user/repo/client/src/api'
Desired behavior
There should not be any impact after upgrading.
Test code to reproduce
- Upgrade to 13.1.0
- Run Cypress
Cypress Version
13.1.0
Node version
18.16.1
Operating System
macOS 13.4.1
Debug Logs
No response
Other
Looks similar to this issue: https://github.com/cypress-io/cypress/issues/27599
About this issue
- Original URL
- State: open
- Created 10 months ago
- Comments: 15 (4 by maintainers)
Same issue here when upgrading from “12.17.2” to “v13.3.0”… but I FIXED it just now. The error:
Webpack Compilation Error Module not found: Error: Can't resolve 'process/browser.js' in '<another sensitive path>/...Note: In my tsconfig.json, I am using typescript project references feature. The <another sensitive path> above was from the referenced project, which did not have “process” installed. I installed it in the referenced typescript project, and then it worked.
Saw this when upgrading from
v12.12.0->v13.3.0:Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir '<user directory path>/Caches/Cypress/13.3.0/Cypress.app/Contents/Resources/app/node_modules/process/browser.js'Webpack Compilation Error Module not found: Error: Can't resolve 'process/browser.js' in '<another sensitive path>/dist/lib'Installing the
processpackage manually also resolved the issue.Same thing is happening on my end - I will try to make a minimal reproduction tonight if I have the chance - however, for now just sticking to v12 works.
Can confirm that installing
pnpm add processworks as a workaround. I’m using a turbo monorepo so I installed it in root:pnpm add -w -D process.hi @tonilaukka. Thank you for opening an issue. are you able to provide a reproduction or see where the
processpackage is inside yournode_modules? I’m wondering ifprocessdid not get installed withcypressdoes
npm i processresolve the issue as in a workaround?