gildas-lormeau / single-file-cli

CLI tool for saving a faithful copy of a complete web page in a single HTML file (based on SingleFile)
GNU Affero General Public License v3.0
602 stars 63 forks source link

Error: Process exited with code null #91

Closed MichaelC001 closed 3 months ago

MichaelC001 commented 4 months ago

CleanShot_2024_05_27_201331 MacOS gets the error when I attempt to save the page

gildas-lormeau commented 4 months ago

This is due to the fact the Docker image is built for x86 processors.

mumoing commented 4 months ago

Had the same problem. window x86 I use the following command npm install "single-file-cli" cd node_modules/single-file-cli Then the code will keep stuck and no results. like this: image I used the release version single-file.exe and the result was the same.


When I go to the .bin directory and execute it, I get a correct .html file, but the terminal will report an error like this. image

My Deno version is as follows: image

gildas-lormeau commented 4 months ago

I'll see if I can reproduce this problem in Windows. There's something that puzzles me though. The code is executed in Node.js instead of Deno. This can be seen in your screenshot of the displayed error. Have you renamed single-file-node.js to single-file?

TommyBloom commented 3 months ago

I'm getting the same error. havent been able to figure it out yet

andjar commented 3 months ago

Got the same deno error when using the npm installed version, but it works with the newest single-file.exe version

gildas-lormeau commented 3 months ago

@andjar Thank you for the additional info. This tends to confirm that the issue is related to the Node.js support. What version of Node.js have you on you machine?

andjar commented 3 months ago

Update: In my case, the error was solved by ensuring that deno was in fact installed (winget install DenoLand.Deno)

The error message I got before was:

C:\Users\andjar>single-file https://wikipedia.org wikipedia.html
Process exited with code null
file:///C:/Users/andjar/AppData/Roaming/npm/node_modules/single-file-cli/lib/deno-polyfill.js:86
                                                reject(new Error(`Process exited with code ${code}`));
                                                       ^

Error: Process exited with code null
    at ChildProcess.<anonymous> (file:///C:/Users/andjar/AppData/Roaming/npm/node_modules/single-file-cli/lib/deno-polyfill.js:86:14)
    at ChildProcess.emit (node:events:518:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Node.js v20.12.0
gildas-lormeau commented 3 months ago

@andjar Thank you, if it's possible for you, could you try to edit the file /lib/deno-polyfill.js in the folder where single-file-cli is installed, replace the line 83 (see below) and tell me if it fixes the issue when using Node.js?

Replace:

if (code === 0 || code === 143 || code === 130) {

with:

if (code === 0 || code === 143 || code === 130 || code === null) {
andjar commented 3 months ago

So, after running winget install DenoLand.Deno in cmd, single-file started working from the command line. When called from R, however, using system() it still failed with the same error as above. However, after adding || code === null as requested, it started working from R as well.

To confirm, I removed || code === null again from /lib/deno-polyfill.js, and the error re-appeared when called from R.

Thanks, I think you got it!

gildas-lormeau commented 3 months ago

Thank you very much for your help and your responsiveness, I have fixed the issue in the version 2.0.45 that I've just released and published on NPM.