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

239
Vistas
Why can't Heroku find a folder my computer can?

My discord bot runs on my computer when I use node index.js but when I do the same thing in the heroku terminal I get the following error which is odd because ./commands is a folder in the connected github and it's working fine on my computer.

node:internal/fs/utils:344
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir './commands'
    at Object.readdirSync (node:fs:1390:3)
    at Object.<anonymous> (/app/index.js:19:25)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: './commands'
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's because you are probably calling the Heroku script from a lower folder - the fs file system runs relative to the current working directory and not relative to the script you called. The solution is to make the path absolute:

fs.readdirSync(path.resolve(__dirname, './commands'))
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