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

Automatically installing NodeJS/NPM is not working on Alpine Linux/musl #13837

Closed
AB-xdev opened this issue May 23, 2022 · 14 comments · Fixed by #14300 or #14632
Closed

Automatically installing NodeJS/NPM is not working on Alpine Linux/musl #13837

AB-xdev opened this issue May 23, 2022 · 14 comments · Fixed by #14300 or #14632

Comments

@AB-xdev
Copy link

AB-xdev commented May 23, 2022

Description of the bug

The automatic installation of NodeJS is not working on Alpine Linux or any other Linux distribution that uses musl instead of libgc

NPM get's downloaded however it's not executable (fails with error=2, No such file or directory).
The error message is a bit confusing as the file itself exists but the linked libraries don't.
When inspecting the downloaded binary with ldd the following is returned:

bash-5.1# ldd /root/.vaadin/node/node
        /lib64/ld-linux-x86-64.so.2 (0x7f1fc697f000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f1fc697f000)
Error loading shared library libstdc++.so.6: No such file or directory (needed by /root/.vaadin/node/node)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f1fc697f000)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.vaadin/node/node)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f1fc697f000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f1fc697f000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /root/.vaadin/node/node)
Error relocating /root/.vaadin/node/node: _ZNKSs7compareEmmRKSs: symbol not found
Error relocating /root/.vaadin/node/node: _ZNSs7replaceEmmPKcm: symbol not found
...

Currently applied workaround by us:

  • Install nodejs and npm via the package manager (apk)
    # Install latest LTS nodejs and npm
    RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs
    RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community/ npm

Related helpful issue: nvm-sh/nvm#1102

Expected behavior

Optimal solution

The correct npm/nodejs is installed for Alpine Linux/musl.

Solution that would improve handling the problem

If Alpine linux/musl is detected and the above error occurs print something like: "Please install nodejs/npm manually for alpine linux due to ..."

Minimal reproducible example

  • Install Docker
  • Start a new alpine container with maven, e.g. docker run --rm -it maven:3-eclipse-temurin-17-alpine /bin/bash
  • Generate a maven project: mvn -B archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
  • Go into the generated directory cd my-app/
  • Run the prepare-frontend goal which should install node: mvn com.vaadin:vaadin-maven-plugin:prepare-frontend

Error message:

[INFO] Couldn't find node. Installing Node and npm to /root/.vaadin.
[INFO] Installing node version v16.15.0
[INFO] Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.gz to /root/.vaadin/node-v16.15.0-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.vaadin/node-v16.15.0-linux-x64.tar.gz into /root/.vaadin/node/tmp
[INFO] Copying node binary from /root/.vaadin/node/tmp/node-v16.15.0-linux-x64/bin/node to /root/.vaadin/node/node
[INFO] Extracting npm
[INFO] Local node installation successful.
[WARNING] Error checking if node is new enough
com.vaadin.flow.server.frontend.FrontendUtils$UnknownVersionException: Unable to detect version of node. Using command /root/.vaadin/node/node --version
    at com.vaadin.flow.server.frontend.FrontendUtils.getVersion (FrontendUtils.java:974)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeVersionAndExecutable (FrontendTools.java:673)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:628)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: com.vaadin.flow.server.frontend.FrontendUtils$CommandExecutionException: Process execution failed
    at com.vaadin.flow.server.frontend.FrontendUtils.executeCommand (FrontendUtils.java:1008)
    at com.vaadin.flow.server.frontend.FrontendUtils.getVersion (FrontendUtils.java:971)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeVersionAndExecutable (FrontendTools.java:673)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:628)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.io.IOException: Cannot run program "/root/.vaadin/node/node": error=2, No such file or directory
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at com.vaadin.flow.server.frontend.FrontendUtils.executeCommand (FrontendUtils.java:1001)
    at com.vaadin.flow.server.frontend.FrontendUtils.getVersion (FrontendUtils.java:971)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeVersionAndExecutable (FrontendTools.java:673)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:628)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessImpl.forkAndExec (Native Method)
    at java.lang.ProcessImpl.<init> (ProcessImpl.java:314)
    at java.lang.ProcessImpl.start (ProcessImpl.java:244)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1110)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at com.vaadin.flow.server.frontend.FrontendUtils.executeCommand (FrontendUtils.java:1001)
    at com.vaadin.flow.server.frontend.FrontendUtils.getVersion (FrontendUtils.java:971)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeVersionAndExecutable (FrontendTools.java:673)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:628)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] Failed to execute the command '[/root/.vaadin/node/node, -v]'
java.io.IOException: Cannot run program "/root/.vaadin/node/node": error=2, No such file or directory
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.executeCommand (FrontendToolsLocator.java:122)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.lambda$verifyTool$2 (FrontendToolsLocator.java:107)
    at java.util.Optional.flatMap (Optional.java:289)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.verifyTool (FrontendToolsLocator.java:107)
    at com.vaadin.flow.server.frontend.FrontendTools.getExecutable (FrontendTools.java:854)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeExecutable (FrontendTools.java:455)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeBinary (FrontendTools.java:1149)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmScriptCommand (FrontendTools.java:1067)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmCliToolExecutable (FrontendTools.java:1046)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmExecutable (FrontendTools.java:980)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmVersion (FrontendTools.java:812)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:647)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessImpl.forkAndExec (Native Method)
    at java.lang.ProcessImpl.<init> (ProcessImpl.java:314)
    at java.lang.ProcessImpl.start (ProcessImpl.java:244)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1110)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.executeCommand (FrontendToolsLocator.java:122)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.lambda$verifyTool$2 (FrontendToolsLocator.java:107)
    at java.util.Optional.flatMap (Optional.java:289)
    at com.vaadin.flow.server.frontend.FrontendToolsLocator.verifyTool (FrontendToolsLocator.java:107)
    at com.vaadin.flow.server.frontend.FrontendTools.getExecutable (FrontendTools.java:854)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeExecutable (FrontendTools.java:455)
    at com.vaadin.flow.server.frontend.FrontendTools.getNodeBinary (FrontendTools.java:1149)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmScriptCommand (FrontendTools.java:1067)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmCliToolExecutable (FrontendTools.java:1046)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmExecutable (FrontendTools.java:980)
    at com.vaadin.flow.server.frontend.FrontendTools.getNpmVersion (FrontendTools.java:812)
    at com.vaadin.flow.server.frontend.FrontendTools.validateNodeAndNpmVersion (FrontendTools.java:647)
    at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend (BuildFrontendUtil.java:132)
    at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute (PrepareFrontendMojo.java:56)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] Couldn't find node. Installing Node and npm to /root/.vaadin.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.630 s
[INFO] Finished at: 2022-05-23T08:58:17Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:23.0.9:prepare-frontend (default-cli) on project my-app: Could not execute prepare-frontend goal.: Failed to install Node: Unable to detect version of Node. Using command /root/.vaadin/node/node --version: Cannot run program "/root/.vaadin/node/node": error=2, No such file or directory -> [Help 1][ERROR]

Versions

  • Vaadin / Flow version: 14+, 23
  • Java version: doesn't matter, I tested it with Java 17
  • OS version: Alpine 3.15
@AB-xdev
Copy link
Author

AB-xdev commented May 23, 2022

Looks like the problem is roughly located here:

/**
* Create a Platform and figure out OS and Architecture.
*
* @return platform instance
*/
public static Platform guess() {
OS os = OS.guess();
Architecture architecture = Architecture.guess();
return new Platform(os, architecture);
}

This class was likely copy pasted from https://github.com/eirslett/frontend-maven-plugin but never updated because this PR is missing: eirslett/frontend-maven-plugin#934

Here the fixed piece of code from the frontend-maven-plugin as comparison:
https://github.com/eirslett/frontend-maven-plugin/blob/9f39dbad0948237ada4e7b19bf90690f94a61b81/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/Platform.java#L92-L107

@mshabarov
Copy link
Contributor

Thanks @AB-xdev for reporting this issue and making a deep investigation of the root cause and solution.
Since you are in a context, would you like to contribute to Vaadin Flow and make a pull request?
No worries if you don't, we can handle it.

@AB-xdev
Copy link
Author

AB-xdev commented May 25, 2022

Since you are in a context, would you like to contribute to Vaadin Flow and make a pull request?

Sorry, but I currently have no capacity to fix this. Would be best if someone else could do it :)

caalador added a commit that referenced this issue Aug 9, 2022
musl is Experimental so using the
experimental download root

Fixes #13837
@caalador caalador self-assigned this Aug 9, 2022
mshabarov pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
vaadin-bot pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
vaadin-bot pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
vaadin-bot pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
@mshabarov
Copy link
Contributor

@AB-xdev the patch for this issue should be available in next Vaadin releases (preliminary in Vaadin 23.1.7, Vaadin 14.8.16). Please test it on your side and let us know if you still have an issues with Node/NPM auto installations by commenting on this ticket or by creating a new one.

vaadin-bot pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
vaadin-bot pushed a commit that referenced this issue Aug 15, 2022
* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>
mshabarov pushed a commit that referenced this issue Aug 15, 2022
#14349)

* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: taefi <taefi.soroosh@gmail.com>
mshabarov pushed a commit that referenced this issue Aug 15, 2022
#14350)

* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: taefi <taefi.soroosh@gmail.com>
mshabarov pushed a commit that referenced this issue Aug 15, 2022
#14348)

* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

* test: Add tests for Platform and unofficial node download URL

Co-authored-by: taefi <taefi.soroosh@gmail.com>

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: taefi <taefi.soroosh@gmail.com>
taefi added a commit that referenced this issue Aug 18, 2022
#14347)

* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

Co-authored-by: taefi <taefi.soroosh@gmail.com>
Co-authored-by: caalador <mikael.grankvist@vaadin.com>
taefi added a commit that referenced this issue Aug 18, 2022
#14346)

* fix: Support Alpine by detecting OS using /etc/alpine-release

musl is Experimental so using the
experimental download root

Fixes #13837

Co-authored-by: taefi <taefi.soroosh@gmail.com>
Co-authored-by: caalador <mikael.grankvist@vaadin.com>
@mshabarov mshabarov reopened this Aug 30, 2022
@caalador
Copy link
Contributor

The issue is that Frontend tools always sets the default download url in FrontendTools:l426 this should use the default value as null as now it always overrides the actual URL to be used as if the user had given the download url manually with the node.download.root parameter.

As a workaround the you could define the parameter as node.download.root=https://unofficial-builds.nodejs.org/download/release/ or the plugin property nodeDownloadRoot as https://unofficial-builds.nodejs.org/download/release/

caalador added a commit that referenced this issue Sep 26, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
mshabarov pushed a commit that referenced this issue Sep 29, 2022
* fix: Do not use a fixed download root

As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837

* fix static mock
vaadin-bot pushed a commit that referenced this issue Sep 29, 2022
* fix: Do not use a fixed download root

As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837

* fix static mock
caalador added a commit that referenced this issue Sep 29, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
mcollovati pushed a commit that referenced this issue Sep 29, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
mshabarov pushed a commit that referenced this issue Sep 29, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
caalador added a commit that referenced this issue Sep 30, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
caalador added a commit that referenced this issue Sep 30, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
caalador added a commit that referenced this issue Sep 30, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
mshabarov pushed a commit that referenced this issue Sep 30, 2022
* fix: Do not use a fixed download root (#14632)

As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837

* Set default in prepare-frontend
mshabarov pushed a commit that referenced this issue Sep 30, 2022
As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837
vaadin-bot pushed a commit that referenced this issue Sep 30, 2022
* fix: Do not use a fixed download root (#14632)

As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837

* Set default in prepare-frontend
vaadin-bot added a commit that referenced this issue Sep 30, 2022
* fix: Do not use a fixed download root (#14632)

As the default download root might be
different depending on the used system
we should not use a hardcoded default if
user has not given a download root.

Fixes #13837

* Set default in prepare-frontend

Co-authored-by: caalador <mikael.grankvist@vaadin.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 23.1.11.

@AB-xdev
Copy link
Author

AB-xdev commented Oct 21, 2022

Thank you for having a look into this however it still doesn't seem to work with vaadin-maven-plugin:23.2.5:

When doing a prepare-frontend it says:

[INFO] Couldn't find node. Installing Node and npm to /home/limitedbuild/.vaadin. 
[INFO] Installing node version v16.17.1 
[INFO] Downloading https://unofficial-builds.nodejs.org/download/release/v16.17.1/node-v16.17.1-linux-x64-musl.tar.gz to /home/limitedbuild/.vaadin/node-v16.17.1-linux-x64-musl.tar.gz
[INFO] No proxies configured 
[INFO] No proxy was configured, downloading directly 
[INFO] Unpacking /home/limitedbuild/.vaadin/node-v16.17.1-linux-x64-musl.tar.gz into /home/limitedbuild/.vaadin/node/tmp 
[INFO] Copying node binary from /home/limitedbuild/.vaadin/node/tmp/node-v16.17.1-linux-x64-musl/bin/node to /home/limitedbuild/.vaadin/node/node 
[INFO] Extracting npm 
[INFO] Local node installation successful. 

and then it just stops and seems to hang up...

The problem does not occur when NodeJS is preinstalled using

RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs \
  && apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community/ npm

My setup is still the same as described in #13837 (comment)

@caalador
Copy link
Contributor

Does the installed node and npm versions in .vaadin work from the command line?

@navee
Copy link

navee commented Jun 7, 2023

This may be caused by the Alpine image. I reproduced this issue when building with Vaadin 24 in the eclipse-temurin:17-jdk-alpine image. After replacing it with eclipse-temurin:17-jdk, the problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment