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

608
Vistas
Node pkg-npm doesn't find/add index.html to his node executable file (index.win.exe)

I'm trying to build a executable of Node.js using pkg-npm

But it doesn't find/add the index.html that I send to node. After compile and executed the index-win.exe that was generated I get this message:

\nodejs_exec\index.html' was not included into executable at compilation stage. Please recompile adding it as asset or script...

I already tried to add the file in the package.json like this:

  "pkg":{

    "scripts": [],
    "assets": [
      "index.html"
    ],
    "targets": [
      "node14-win-x64"
    ]
  },

My node folder is like this:

node_exec
│   index.js
│   package.json    
│   index.html
|   node_modules

And this is my index.js:

const express = require('express');
const app = express();
const PORT = process.env.PORT || 4000;

const open = require('open');
const path = require('path');


app.get('/', (req, res)=>{
    res.sendFile(__dirname + '/index.html');
});


app.listen(PORT, ()=>{ console.log(`Listening on port ${PORT}`)})

And the command that I used to create the .exe is:

pkg index.js

over 4 years ago · Santiago Trujillo
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