Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

378
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda