Answer the question
In order to leave comments, you need to log in
Why am I getting errors when building a node.js app via pkg?
I'm getting errors when building an application via PKG.
This is how my package.json file looks like:
This is how my index.js file (entry point) looks like:
I get errors while compiling the project:
I didn't find a lot of information on the Internet to solve this issue. But many write that this is due to ES6, because I use module imports. How can I solve this problem and compile my CLI application - into an .exe application?
Answer the question
In order to leave comments, you need to log in
If the problem is only in ES6, then try using Babel with the @babel/preset-env preset, which will automatically replace the ES6 code with ES5 compatible code.
Or just replace import with require.
// К примеру
import fs from 'fs'
// На это
const fs = require('fs');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question