nodejs / nodejs/node

Error [ERR_INTERNAL_ASSERTION]: Unexpected module status 0. Cannot require() ES Module ... because it is not yet fully loaded.

Abierto
#62,130 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

esm
Lenguaje dominante
JavaScript
Estrellas
122k
Forks
37.4k
Merge medio
4 d 3 h
PR fusionados (30 d)
272

Descripción

Version

25.8.0

Platform
Linux nic-desktop 6.17.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan  9 17:01:16 UTC 2026 x86_64 GNU/Linux
Subsystem

require(esm)

What steps will reproduce the bug?
  1. Clone https://github.com/nicolo-ribaudo/babel-polyfills/tree/nodejs-bug
  2. Run yarn && yarn build
  3. Run yarn jest es-shims

Note that this is not using Jest's vm-based ESM support. It's using jest-light-runner to run directly in native Node.js ESM.

How often does it reproduce? Is there a required condition?

Consistently. Note that if I run only one test (yarn jest es-shims -t "tepmlate tag") it does not fail.

What is the expected behavior? Why is that the expected behavior?

That it does not tell me to submit a bug report :P

What do you see instead?
    Error [ERR_INTERNAL_ASSERTION]: [BABEL]: Unexpected module status 0. Cannot require() ES Module /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/lib/index.js because it is not yet fully loaded.
    This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
    Try await-ing the import() sequentially in a loop instead.
     (From /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/test/node_modules/@@/babel-plugin-polyfill-es-shims.js in non-loader-hook thread)
    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
     (While processing: /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/test/node_modules/@@/babel-plugin-polyfill-es-shims.js)
        at assert.fail (node:internal/assert:17:9)
        at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:358:16)
        at loadESMFromCJS (node:internal/modules/cjs/loader:1620:24)
        at Module._compile (node:internal/modules/cjs/loader:1785:5)
        at Object..js (node:internal/modules/cjs/loader:1934:10)
        at Module.load (node:internal/modules/cjs/loader:1524:32)
        at Module._load (node:internal/modules/cjs/loader:1326:12)
        at TracingChannel.traceSync (node:diagnostics_channel:328:14)
        at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
        at Module.require (node:internal/modules/cjs/loader:1547:12)
        at require (node:internal/modules/helpers:152:16)
        at Object.<anonymous> (/home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/test/node_modules/@@/babel-plugin-polyfill-es-shims.js:1:18)
        at Module._compile (node:internal/modules/cjs/loader:1803:14)
        at Object..js (node:internal/modules/cjs/loader:1934:10)
        at Module.load (node:internal/modules/cjs/loader:1524:32)
        at Module._load (node:internal/modules/cjs/loader:1326:12)
        at TracingChannel.traceSync (node:diagnostics_channel:328:14)
        at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
        at Module.require (node:internal/modules/cjs/loader:1547:12)
        at require (node:internal/modules/helpers:152:16)
Additional information

No response

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con los comandos de babel-polyfills indicados en el issue y empieza después por ModuleLoader.importSyncForRequire en node:internal/modules/esm/loader y las entradas relacionadas de la pila del loader de CommonJS. Compara el comportamiento de una sola prueba con el de la suite completa y utiliza la ruta require(esm) indicada para rastrear el estado de carga de módulos. Se considera terminado cuando la reproducción proporcionada ya no provoca la assertion interna.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.