Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NodeJS_20_jll needs "node" command to be defined #9233

Closed
fonsp opened this issue Aug 10, 2024 · 4 comments
Closed

NodeJS_20_jll needs "node" command to be defined #9233

fonsp opened this issue Aug 10, 2024 · 4 comments

Comments

@fonsp
Copy link
Contributor

fonsp commented Aug 10, 2024

@ultrapoci posted this issue: JuliaPluto/PlutoPDF.jl#17

PlutoPDF uses NodeJS_20_jll to first install JS dependencies with the npm binary in a scratch space, and then node to run a pltuo-to-pdf export.

It looks like installing dependencies is not working on Windows because one of the dependencies assumes that the node command is defined during the npm install process. Is this something that BinaryBuilder can help with?

Here is part of the original issue:

The pluto_to_pdf function fails with the following error (taken from the log file):

229 error code 1
230 error path C:\Users\nicho\.julia\scratchspaces\6eb38059-8c05-41f7-8871-5e7e2697ace6\build_dir3\node_modules\puppeteer
231 error command failed
232 error command C:\Windows\system32\cmd.exe /d /s /c node install.mjs
233 error "node" non   riconosciuto come comando interno o esterno,
233 error  un programma eseguibile o un file batch.
234 verbose exit 1

Line 233 translates to "node is not recognized as a command or batch file".

This is caused by this line in the "Project.toml" of puppeteer (js dependency that we are trying to install):

https://github.com/puppeteer/puppeteer/blob/14717a7f3ec3d2012abbc4ce0e7ac00bf4375655/packages/puppeteer/package.json#L41

@giordano
Copy link
Member

How are things executed on the Julia side?

@fonsp
Copy link
Contributor Author

fonsp commented Aug 10, 2024

@giordano
Copy link
Member

I don't know how to reproduce the workflow locally, and specifically for Windows I don't have access to it, but I think you want to do something along these lines (I couldn't test it, so I don't know if it's correct, but take the gist of it)

    # Add NodeJS PATH to the existing PATH environment variable 
    path_sep = Sys.iswindows() ? ';' : ':'
    path_list = prepend!(split(get(ENV, "PATH", ""), path_sep), NodeJS_20_jll.PATH_list)
    path = join(path_list, path_sep)
    npm_cmd = addenv(`$(npm)`, "PATH" => path)

    cd(dir) do
        run(`$(npm_cmd) --version`)
        run(`$(npm_cmd) install`)
    end

@fonsp
Copy link
Contributor Author

fonsp commented Aug 10, 2024

Ahh I see, thanks! That's good advice :)

@fonsp fonsp closed this as completed Aug 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants