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

287
Views
how to make .exe from nodejs project

Im trying to make .exe from my nodejs project. I'm using the pkg command but when I type pkg package.json in cmd, i get this message

> pkg@5.8.0
    > Warning Babel parse has failed: This experimental syntax requires enabling the parser plugin: "importAssertions". (1:39)
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules\puppeteer\.local-chromium
  %2: path-to-executable/puppeteer
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules\puppeteer\.local-chromium
  %2: path-to-executable/puppeteer
> Warning Failed to make bytecode node10-x64 for file`

I am importing the JSON file with the following:

import config from "../../config.json" assert {type: "json"}

Here is my package.json: package.json

Am I importing config.json the wrong way? Am I packaging my app the wrong way? Am I doing the wrong way to make .exe ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Okay, I'll make an answer so I can edit it and be more thorough than a comment, though I can't be sure that this is the full solution, this is definitely part of it.

You need to install the importAssertions Babel plugin.

You can do that by running this line in the cmd line:

npm install --save-dev @babel/plugin-syntax-import-assertions

Also, be aware that the syntax import config from "../../config.json" assert {type: "json"} is experimental, and is not yet part of the actual standard. That's why you need to install the plugin to use it. Instead of what you are doing, what I would reccomend is simply modifying config.json to be config.js and making the js file:

module.exports = {
    //whatever json was originally in the config file
}

This would mean you would no longer need the experimental syntax and, unless it's actually important the config file be a straight json file, it would be easier. It also means you won't have to fix things if/when that experimental syntax changes slightly.

about 4 years ago · Juan Pablo Isaza Report
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!