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

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