Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!