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

377
Vistas
Node.js: cannot find module ... imported from

This makes no sense. The file exists, but i just cannot import it. My code has a lot of imports in the same format, but only this one is failing.

The error

[The code] (bin/hyp.js)

#!/usr/bin/env node


process.title = "hyp"

import subcommand from 'subcommand'
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'

import * as hyper from '../lib/hyper/index.js'

import info from '../lib/commands/info.js'
import create from '../lib/commands/create.js'
import seed from '../lib/commands/seed.js'
import unseed from '../lib/commands/unseed.js'
import beam from '../lib/commands/beam.js'
import alias from '../lib/commmands/alias.js'

The folder structure:

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

0

According to Node.js Documentation

You must either change the filename extension of the module to be .mjs, so change alias.js to be alias.mjs (and change the import as appropriate)

OR, you can add this config option to package.json:

"type": "module"

This will allow you to use include instead of require syntax.

about 4 years ago · Juan Pablo Isaza Denunciar

0

If your importation alias is really a node modules you just have to import it like this "import alias from 'alias' ".

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