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

286
Vistas
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 Respuestas
Responde la pregunta

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 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