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
Executable file package problem with imports on macbook

I am using pkg package for creating executable file for Windows and MacOS. I created simple script to show what is the problem:

const fs = require("fs");

if (!fs.existsSync("settings/config.json")) {
  console.error("Could not find config.json file!");
} else {
  console.log("Found! Works");
}

So basically it just has to check if settings/config.json file exists. When I run pkg test.js it compiles it for Windows and MacOS. On Windows when I run exe file everything works fine and I get Found! Works. When I run script by node test.js it also works fine but after I make executable from it and run it I get Could not find config.json file!. What can be a problem? Why MacOS cannot find same file after compiling it to executable file when it works by running node test.js? Is it about any folder structure or MacOS having anoter way of importing it or something?

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