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

595
Views
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
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!