Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

98
Vistas
Node import statement can't recognize ../ prefix

I am trying to use the ES Module import with a path like ../module.js and it gives me this error:

node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 

Here is the structure of the folders:

.
├── module.js
├── index.js
├── folder
│   └── test.js

Also here is the import and export statements

//folder/test.js
import { test } from "../module"

//module.js
export async function test(data) {
    //Do Stuff then return data
}

Obviously, I have changed some file names and removed the function code. Please let me know if this is a problem.

Thank you!

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

In ECMAScript Modules, file extensions are mandatory according to the documentation, as well as directory indexes must be explicitly specified:

import { test } from "../module.js";
about 4 years ago · Juan Pablo Isaza Denunciar

0

Try using require:

const { test } = require('../module.js')
about 4 years ago · Juan Pablo Isaza Denunciar

0

module is already declared into nodejs, try changing the name of your file to something else.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda