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

101
Visualizações
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 à 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