Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ERR_INTERNAL_ASSERTION with Node.js >= v22.1.0 and experimental-detect-module set #30101

Closed
MikeMcC399 opened this issue Aug 25, 2024 · 1 comment

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Aug 25, 2024

Current behavior

TypeScript project fails if NODE_OPTIONS='--experimental-detect-module' is set.

Your configFile is invalid: <project-directory>/cypress.config.ts

It threw an error when required, check the stack trace below:

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.

Desired behavior

EITHER

  1. Cypress should be compatible with the Node.js option --experimental-detect-module

OR

  1. The incompatibility should be documented.

Test code to reproduce

Use repo https://github.com/AtofStryker/cypress-issue-30084 from @AtofStryker

git clone https://github.com/AtofStryker/cypress-issue-30084
cd cypress-issue-30084
n 22.6.0 # select Node.js v22.6.0
npm ci
export NODE_OPTIONS='--experimental-detect-module'
node -v
npx cypress run --component

Cypress Version

13.13.3

Node version

v22.1.0 - v22.6.0

For v22.7.0 and later see #30084 where the Node.js option --experimental-detect-module is set by default

Not reproducible on Node.js 20.x LTS

Operating System

Ubuntu 22.04.4 LTS

Debug Logs

$ npx cypress run --component
[21749:0825/122643.334887:ERROR:node_bindings.cc(305)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.

DevTools listening on ws://127.0.0.1:40557/devtools/browser/fc00bfd8-6742-4b88-9670-6e60b2726f19
(node:21932) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/mike/.cache/Cypress/13.13.3/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21932) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Your configFile is invalid: /home/mike/github/tmp/cypress-issue-30084/cypress.config.ts

It threw an error when required, check the stack trace below:

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at assert (node:internal/assert:14:11)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:329:5)
    at new ModuleJobSync (node:internal/modules/esm/module_job:313:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:314:11)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)
    at Module._compile (node:internal/modules/cjs/loader:1503:5)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:125:16)
    at loadFile (/home/mike/.cache/Cypress/13.13.3/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:89:14)
    at EventEmitter.<anonymous> (/home/mike/.cache/Cypress/13.13.3/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:116:38)
    at EventEmitter.emit (node:events:520:28)

Other

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants