Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mismatch between npm and node #122

Closed
korsbo opened this issue May 3, 2024 · 5 comments · Fixed by #123
Closed

Mismatch between npm and node #122

korsbo opened this issue May 3, 2024 · 5 comments · Fixed by #123
Labels
bug Something isn't working

Comments

@korsbo
Copy link

korsbo commented May 3, 2024

Hi, I'm afraid that I don't have a simple reproducer, but I occasionally seem to get some error that seems to arise from a version mismatch between npm and node:

[ Info: DocumenterVitepress: building Vitepress site.
ERROR: npm v10.2.4 is known not to run on Node.js v10.19.0.  This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at [https://nodejs.org/.](https://nodejs.org/)

ERROR:
/build/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/lib/node_modules/npm/lib/utils/exit-handler.js:19
  const hasLoadedNpm = npm?.config.loaded
                           ^

SyntaxError: Unexpected token .
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at module.exports (/build/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/lib/node_modules/npm/lib/cli-entry.js:15:23)
    at module.exports (/build/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/lib/node_modules/npm/lib/es6/validate-engines.js:39:10)
    at module.exports (/build/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/lib/node_modules/npm/lib/cli.js:4:31)
ERROR: LoadError: failed process: Process(`/build/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/bin/npm install`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:565 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:480
  [3] run
    @ ./process.jl:477 [inlined]
  [4] (::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String})()
    @ DocumenterVitepress ~/.julia/packages/DocumenterVitepress/AH5XK/src/writer.jl:[186](https://github.com/PumasAI/DeepPumas.jl/actions/runs/8939019518/job/24554755713#step:9:187)
  [5] cd(f::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String}, dir::String)
    @ Base.Filesystem ./file.jl:112
  [6] render(doc::Documenter.Document, settings::MarkdownVitepress)
    @ DocumenterVitepress ~/.julia/packages/DocumenterVitepress/AH5XK/src/writer.jl:180
  [7] runner(::Type{DocumenterVitepress.MarkdownFormat}, fmt::MarkdownVitepress, doc::Documenter.Document)
    @ DocumenterVitepress ~/.julia/packages/DocumenterVitepress/AH5XK/src/DocumenterVitepress.jl:27
  [8] dispatch(::Type{Documenter.FormatSelector}, ::MarkdownVitepress, ::Vararg{Any})
    @ Documenter.Selectors ~/.julia/packages/Documenter/CJeWX/src/utilities/Selectors.jl:170
  [9] render(doc::Documenter.Document)
    @ Documenter ~/.julia/packages/Documenter/CJeWX/src/writers.jl:45
 [10] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter ~/.julia/packages/Documenter/CJeWX/src/builder_pipeline.jl:258
 [11] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors ~/.julia/packages/Documenter/CJeWX/src/utilities/Selectors.jl:170
 [12] #86
    @ ~/.julia/packages/Documenter/CJeWX/src/makedocs.jl:248 [inlined]
 [13] withenv(::Documenter.var"#86#88"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base ./env.jl:257
 [14] #85
    @ ~/.julia/packages/Documenter/CJeWX/src/makedocs.jl:247 [inlined]
 [15] cd(f::Documenter.var"#85#87"{Documenter.Document}, dir::String)
    @ Base.Filesystem ./file.jl:112
 [16] #makedocs#84
    @ ~/.julia/packages/Documenter/CJeWX/src/makedocs.jl:247 [inlined]

I get that pretty randomly in CI and I have a colleague who had another issue that indicated that 'npm istall' in

run(`$(npm) install`)

was trying to use a nonexistent global node in /usr/.... rather than the asset in ~/.julia/artifacts/.../bin/node that we should get from NodeJS_20_jll. I figure that this might explain how one can get a node / npm version mismatch like the error msg indicates.

My colleagues stacktrace:

\[ Info: DocumenterVitepress: building Vitepress site.
/usr/bin/env: 'node': No such file or directory
ERROR: LoadError: failed process: Process(`/home/jrun/data/.julia/artifacts/f66014744496ef887b3e70e4fa3ff1fd116ce629/bin/npm install`, ProcessExited(127)) [127]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:565 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:480
  [3] run
    @ ./process.jl:477 [inlined]
  [4] (::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String})()
    @ DocumenterVitepress ~/data/.julia/packages/DocumenterVitepress/AH5XK/src/writer.jl:186
  [5] cd(f::DocumenterVitepress.var"#7#9"{MarkdownVitepress, String}, dir::String)
    @ Base.Filesystem ./file.jl:112
  [6] render(doc::Documenter.Document, settings::MarkdownVitepress)
    @ DocumenterVitepress ~/data/.julia/packages/DocumenterVitepress/AH5XK/src/writer.jl:180
  [7] runner(#unused#::Type{DocumenterVitepress.MarkdownFormat}, fmt::MarkdownVitepress, doc::Documenter.Document)
    @ DocumenterVitepress ~/data/.julia/packages/DocumenterVitepress/AH5XK/src/DocumenterVitepress.jl:27
  [8] dispatch(::Type{Documenter.FormatSelector}, ::MarkdownVitepress, ::Vararg{Any})
    @ Documenter.Selectors ~/data/.julia/packages/Documenter/pA5Sa/src/utilities/Selectors.jl:170
  [9] render(doc::Documenter.Document)
    @ Documenter ~/data/.julia/packages/Documenter/pA5Sa/src/writers.jl:45
 [10] runner(#unused#::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter ~/data/.julia/packages/Documenter/pA5Sa/src/builder_pipeline.jl:258
 [11] dispatch(#unused#::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors ~/data/.julia/packages/Documenter/pA5Sa/src/utilities/Selectors.jl:170
 [12] #84
    @ ~/data/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:248 [inlined]
 [13] withenv(::Documenter.var"#84#86"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base ./env.jl:197
 [14] #83
    @ ~/data/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]
 [15] cd(f::Documenter.var"#83#85"{Documenter.Document}, dir::String)
    @ Base.Filesystem ./file.jl:112
 [16] #makedocs#82
    @ ~/data/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]

It's a bit annoying to get an issue without a reproducer, but maybe someone here has some idea of how to fix this anyway.

Thanks for your efforts!

@asinghvi17 asinghvi17 added the bug Something isn't working label May 3, 2024
@asinghvi17
Copy link
Collaborator

Huh! Yeah we should be using the JLL, but I will look through the code again and see what's going on...

@asinghvi17
Copy link
Collaborator

julia> using NodeJS_20_jll

julia> npm
"/Users/anshul/.julia/artifacts/e972793fde0fa31a7fc77a58fa34e5ebd54e6658/bin/npm"

julia> NodeJS_20_jll.npm |> typeof
String

so this doesn't adjust the PATH appropriately. Looks like an error on the NodeJS_jll end...

asinghvi17 added a commit to asinghvi17/Yggdrasil that referenced this issue May 3, 2024
@asinghvi17
Copy link
Collaborator

JuliaPackaging/Yggdrasil#8595 should fix this issue, we will have to restrict compat for NodeJS_20_jll to v20.12.2 and above here.

@korsbo
Copy link
Author

korsbo commented May 3, 2024

Horray! Thanks 🥇

@asinghvi17
Copy link
Collaborator

Update: the Yggdrasil PR would have been breaking for users of NodeJS_20_jll, so I opted to use node to set the environment variables in #123.

giordano pushed a commit to JuliaPackaging/Yggdrasil that referenced this issue May 3, 2024
* [NodeJS_20_jll] Update version + make all products executable

This fixes LuxDL/DocumenterVitepress.jl#122 where the PATH was not adjusted appropriately.

* Revert executableproduct change
asinghvi17 added a commit that referenced this issue May 6, 2024
thofma pushed a commit to thofma/DocumenterVitepress.jl that referenced this issue May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants