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

357
Vistas
Node Error: Cannot use import statement outside a module even though I am not

I have tried adding "type: module" to package.json but that does not work.

I have tried renaming the file extension to .mjs and .cjs but that does not work either.

I have switched my imports/require between the following:

import fetch from 'node-fetch';

import _metascraper from 'metascraper';
import url from 'metascraper-url';
import description from 'metascraper-description';
const metascraper = _metascraper([title(),description()]);

To using require:

const metascraper = require('metascraper')([
  require('metascraper-description')(),
  require('metascraper-title')()
])

The errors are either:

  • Cannot use import statement outside a module
  • Rename to .cjs or add type: module to package.json
  • Cannot find module
about 4 years ago · Juan Pablo Isaza
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