Description
Current behavior
When I upgrade my cypress instance from 6.8.0
to 7.1.0
I get an error where cypress thinks that my plugins file has invalid syntax, but the root cause is that it can't import lodash
that I use for deep merge of default & our settings.
This used to work fine & I've tried to mitigate this by creating a custom importer akin to this: https://stackoverflow.com/questions/62298396/making-a-dependencys-dependencies-available-with-yarn-2/64242991#64242991 …alas it didn't help
I do have lodash
installed in the root "workspace".
**Message:** The plugins file is missing or invalid.
Your `pluginsFile` is set to `…/web-ui/cypress/plugins/index.ts`, but either the file is missing, it contains a syntax error, or threw an error when required. The `pluginsFile` must be a `.js`, `.ts`, or `.coffee` file.
Or you might have renamed the extension of your `pluginsFile`. If that's the case, restart the test runner.
Please fix this, or set `pluginsFile` to `false` if a plugins file is not necessary for your project.
**Details:** Error: Cannot find module 'lodash'
Require stack:
- …/web-ui/cypress/plugins/index.ts
- /home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js
- /home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/child/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:887:15)
at Module._load (internal/modules/cjs/loader.js:732:27)
at Function.f._load (electron/js2c/asar_bundle.js:5:12684)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/opt/dev/…/pool/web-ui/cypress/plugins/index.ts:8:19)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12684)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at runPlugins (/home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:175:15)
at Object.<anonymous> (/home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/child/index.js:8:25)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
**Stack trace:**
Error: The plugins file is missing or invalid.
Your pluginsFile
is set to …/web-ui/cypress/plugins/index.ts
, but either the file is missing, it contains a syntax error, or threw an error when required. The pluginsFile
must be a .js
, .ts
, or .coffee
file.
Or you might have renamed the extension of your pluginsFile
. If that's the case, restart the test runner.
Please fix this, or set pluginsFile
to false
if a plugins file is not necessary for your project.
at Object.get (/home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/errors.js:988:15)
at EventEmitter. (/home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/index.js:154:21)
at EventEmitter.emit (events.js:315:20)
at ChildProcess. (/home/…/.cache/Cypress/7.1.0/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
at ChildProcess.emit (events.js:315:20)
at emit (internal/child_process.js:903:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
### Test code to reproduce
I've tried to reproduce this in the `cypress-test-tiny`, but wasn't able to… if you can point me in some direction I'll provide what's needed
### Versions
- Operating System: Ubuntu 20.10
- Cypress: 7.1.0
- Yarn: 2.4.0-git.20210226.hash-97663a9d with P'n'P enabled & workspaces setup
- Typescript: 4.2.3