You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js:7
const mod = require(moduleName)
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/pcanella/gitrepo/feecalculatorfe/tmpBstackCompiledJs/cypress.config.js from /Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js not supported.
cypress.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead either rename cypress.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/pcanella/gitrepo/feecalculatorfe/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at Object.<anonymous> (/Users/pcanella/.nvm/versions/node/v18.19.0/lib/node_modules/browserstack-cypress-cli/bin/helpers/requireModule.js:7:13) {
code: 'ERR_REQUIRE_ESM'
}
The text was updated successfully, but these errors were encountered:
This seems to be a dependency issue, you can clone our sample repo and try running a sample project and use the same set of dependency and structure in your project file.
If this could not solve the issue please create a support ticket with Browserstack through this Contact Us page
@Prakash21k The sample repo doesn't have this problem, because it doesn't have "type": "module" set in package.json. We're also running in this issue and are having to do a big workaround, because browserstack-cypress-cli is not compatible with these modern setups, which are used by Vite projects, for example.
I'm trying to run Cypress tests on Browserstack, but keep getting this. I'm on Cypress 13.6.4 and
[email protected]
Not sure how to fix this ESM/CJS issue. Here's my
cypress.config.ts
The text was updated successfully, but these errors were encountered: