Generated Windows executable doesn't run successfully with Node 10 target
Given Project: https://github.com/digital-dj-tools/mp3-parser pkg version: 4.4.0 pkg targets: node10-win-x64,node10-macos-x64,node10-linux-x64
npm install
clojure -Acompile-cljs
npm run build
Expected The Windows and Linux generated executables run ok (I can't test the Macos executable, I don't have a Mac).
Actual The Linux executable runs successfully, but the Windows executable does not.
From Bash (WSL)
/mnt/d/Projects/mp3-parser/pkg$ ./mp3-parser-linux ./test-resources/lame-mp3-cbr-stereo-44100khz-192kbps-id3v2.mp3
<generates correct output>
From CMD (Windows)
D:\Projects\mp3-parser\pkg>mp3-parser-win.exe ..\test-resources\lame-mp3-cbr-stereo-44100khz-192kbps-id3v2.mp3
<no output>
D:\Projects\mp3-parser\pkg>echo %errorlevel%
-1073741819
However, if I change targets to node8-win-x64,node8-macos-x64,node8-linux-x64, the Windows and Linux generated executables run ok.
Why do some of the generated executables (Windows) not run successfully with Node 10?
I'm seeing the same issue when targetting node10-win-x86
When running an exe packaged with 4.4.0 I see an error
Pkg: Error reading from file
It works correctly when packaged with 4.3.8
Yes, there is a compatibility issue with node@10 and [email protected]. It will work with [email protected] or [email protected].
I confirm, that using [email protected] will fail to produce an exe for windows 10. Using same config and module with [email protected] works.
thanks @rao123dk
Same for newer 4.4.x releases
I can confirm I could successfully compile a Mac target from Windows using [email protected]. I had to chmod +x the file on the Mac, though.
I had exact same problem and it solved with command below:
pkg ./dist/index.js --target node12-win-x64 --options max_old_space_size=4096
I faced the same problem!
still an issue, tried 4.3.x with node10-and-lower on win, no combinations working. Exe opens and exists immediately.
@Nashorn check this file. You should use one of them in order to get it working.
@albertmourato thanks for your help. I've tried a number of diff combinations, can't say I tried them all on that list. At this point its trial and error (windows only), the thing works flawlessly on mac/linux.
Let me share my config and small example, maybe i have it configured wrong? Basically making a self-executing server (using the npm http-server module) that launches a localhost from the folder it is opened from. Works perfect like i said on macos/linux, just not on Windows, even with various targets and diff versions of PKG. CMD window opens to black screen and closes immediately.
When i cd into folder an open the .exe, i see my logs fine, no errors, and cmd stays open. No idea at this point. Any help appreciated:
{
"name": "pkgtest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "test",
"scripts": {
"start": "http-server ./ -o index.html"
},
"bin": "$DIR/node_modules/http-server/bin/http-server",
"dependencies": {
"http-server": "^0.12.3"
},
"assets": [
"./node_modules/*",
"./node_modules/http-server"
]
}
And index.js:
var http_server = require("http-server");
var path = require("path");
const cwd = process.cwd();
var exec = require('child_process').exec;
var s = process.execPath;
s = s.substr(0,s.lastIndexOf("/"));
console.log("app path",s);//not used
console.log("process.execPath",path.dirname(process.execPath));
console.log("process.cwd",process.cwd());
console.log("process.pkg",process.pkg);
console.log("process.versions",process.versions)
if(http_server){
console.log("http_server", "successs");
}else{
console.log("http_server", "Server module not found")
}
process.chdir(path.dirname(process.execPath));
console.log("changed dir to",process.cwd());
console.log("Starting npm");
exec("npm start")
process.exit();
Also, after the exe is built, i copy it into a "test" folder that has 1 index.html file as well as a node_modules/ folder with http-server installed in there. So on mac, it launches the localhost server on the folder at :8080, i am 90% there
any help on this?
its a dead simple example, no one from pkg team knows?
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.