eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.22k stars 868 forks source link

Cannot download node - 404 #952

Closed Matdarich closed 3 years ago

Matdarich commented 3 years ago

I am using the frontend-maven-plugin to install node. Unfortunatly I get following exception while building.

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.0:install-node-and-npm (install node and npm) on project frontend: **Could not download Node.js: Got error code 404 from the server.** -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.0:install-node-and-npm (install node and npm) on project frontend: Could not download Node.js: Got error code 404 from the server. at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) ...

The URL of the node root ist correct and can be downloaded manually by me:

   [INFO] Found proxies: [xxx-proxy{protocol='http', host='proxy.xxx', port=8080, nonProxyHosts='*.xxx'}]
   [INFO] Installing node version v12.9.1
   [INFO] Downloading http://nodejs.org/dist/v12.9.1/node-v12.9.1-linux-x64.tar.gz to /home/myname/.m2/repository/com/github/eirslett/node/12.9.1/node-12.9.1-linux-x64.tar.gz
   [INFO] Downloading via proxy xxx-proxy{protocol='http', host='proxy.xxx', port=8080, nonProxyHosts='*.xxx'}`

This is my maven setting:

    <plugin>
                   <groupId>com.github.eirslett</groupId>
                   <artifactId>frontend-maven-plugin</artifactId>
                  <version>1.11.0</version>
                   <configuration>
                       <nodeVersion>v12.9.1</nodeVersion>
                       <npmVersion>5.6.0</npmVersion>
                       <workingDirectory>src/main/resources/cmdbui/</workingDirectory>
                       <installDirectory>target/tmp</installDirectory>
                   </configuration>
                   <executions>
                       <execution>
                           <id>install node and npm</id>
                           <goals>
                               <goal>install-node-and-npm</goal>
                           </goals>
                       </execution>
                       <execution>
                           <id>npm install</id>
                           <goals>
                               <goal>npm</goal>
                           </goals>
                       </execution>
                       <execution>
                           <id>npm run build</id>
                           <goals>
                               <goal>npm</goal>
                           </goals>
                           <configuration>
                               <arguments>run build</arguments>
                           </configuration>
                       </execution>
                       <execution>
                           <id>prod</id>
                           <goals>
                               <goal>npm</goal>
                           </goals>
                           <configuration>
                               <arguments>run-script build</arguments>
                           </configuration>
                           <phase>generate-resources</phase>
                       </execution>
                   </executions>
               </plugin>

In my maven settings.xml our corp. proxy is also set

   <proxy>  
       <id>xxx-proxy</id>  
        <active>true</active>    
        <protocol>http</protocol>     
        <host>proxy.xxx</host>
        <port>8080</port>
        <nonProxyHosts>*.xxx</nonProxyHosts>
  </proxy>

So the plugin should use the proxy correctly given my the maven settings, but still I cannot download node.

EDIT: I use Linux. I do not have installed node on my machine manually

eirslett commented 3 years ago

Maybe the proxy doesn't have an opening to download from http://nodejs.org/dist/v12.9.1/node-v12.9.1-linux-x64.tar.gz ? That URL works when I try it in my browser, without a proxy.

MunsMan commented 3 years ago

I have the same Issue on Mac and I have Node installed on my system. I face this problem with or without a specific proxy.

eirslett commented 3 years ago

@MunsMan which Mac do you run (The new M1?) Which version of the frontend-maven-plugin, and versions of Node and npm is specified in the pom.xml file?

Matdarich commented 3 years ago

I solved the problem on my machine. It was an invalid setting of the proxy. So no issue of the plugin. Sorry. Thanks for the your help.

MunsMan commented 3 years ago

@eirslett No, it is an Intel based from 2015. I rebuild my application und I'm running docker now. I will probably give it a try later again and if I still face the issue, I can reopen this one. Thanks for the fast response.

Yes, I specified the node and rpm version and I tried using yarn as well. I tried the latest version of your Plugin. It is likely that the mistake was on my side. I don't use maven that often.

jowin-yip-TR commented 3 years ago

@eirslett I using M1 Mac and it tries to download https://nodejs.org/dist/v10.15.3/node-v10.15.3-darwin-arm64.tar.gz which is 404.

[INFO] Installing node version v10.15.3
[INFO] Downloading https://nodejs.org/dist/v10.15.3/node-v10.15.3-darwin-arm64.tar.gz to /Users/myname/.m2/repository/com/github/eirslett/node/10.15.3/node-10.15.3-darwin-arm64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
eirslett commented 3 years ago

@jowin-yip-TR with the M1 you need to use version 1.11.0 (or newer) of this plugin.

gronono commented 3 years ago

After upgrading from 1.10.0 to 1.11.0, I get also the 404 error. The plugin try to download nodejs from https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64-musl.tar.gz instead of https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.gz.

I also tried on version 1.10.1 and I get the same behavior as version 1.11.0.

I got this error only when I launch maven throught our Gitlab-Runner which is running on a Kubernetes Cluster deployed on a standard Linux Arch64 (Debian). The runner is deployed using image gitlab/gitlab-runner:v13.4.1. But the gitlab's job use an image based on adoptopenjdk/openjdk14:alpine.

I don't reproduce the issue on my own computer which is also an Linux Arch64 (Linux Mint).

eirslett commented 3 years ago

@gronono did you override the nodeDownloadRoot configuration? It's supposed to get alpine builds from https://unofficial-builds.nodejs.org/download/release/, there is some logic in the plugin for that.

gronono commented 3 years ago

I use the following configuration

<plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend-maven-plugin.version}</version>
                <configuration>
                    <nodeVersion>${node.version}</nodeVersion>
                    <downloadRoot>${node.url}</downloadRoot>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                    </execution>
                    <execution>
                        <id>set-npm-registry</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>config set registry=${npm.registry.url}</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

with values

 <node.url>https://nodejs.org/dist/</node.url>
        <node.version>v14.15.4</node.version>
        <npm.registry.url>https://registry.npmjs.org/</npm.registry.url>

It is configurable because on some projects, we use a proxy / cache but not in this project.

AshishKapoor commented 3 years ago

@jowin-yip-TR with the M1 you need to use version 1.11.0 (or newer) of this plugin.

This worked for me on my M1 mac.

Thanks!

taoguoliang commented 3 years ago

@eirslett It is invalid for my windows. Following is my configuration, i have used mirror of taobao.

            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.9.1</version>
                <configuration>
                    <nodeVersion>v10.16.0</nodeVersion>
                    <npmVersion>6.9.0</npmVersion>
                    <!--配置公网的镜像地址-->
                    <nodeDownloadRoot>http://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
                    <npmDownloadRoot>http://npm.taobao.org/mirrors/npm/</npmDownloadRoot>
                    <!--配置公网的npm仓库地址-->
                    <npmRegistryURL>http://npm.thunisoft.com</npmRegistryURL>
                    <!--前端资源所在路径(每个项目可能不一样,可以固定文件夹)-->
                    <workingDirectory>./web</workingDirectory>
                </configuration>
                <executions>
                    <!--执行npm install 命令-->
                    <execution>
                        <id>npm install</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <!--前端资源打包过程-->
                    <!--执行npm run build-->
                    <execution>
                        <id>npm run build</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
taoguoliang commented 3 years ago

fixed, can not use taobao.

Sevyls commented 3 years ago

any progress? is there any architecture flag parameter / flag?

eirslett commented 3 years ago

@Sevyls seems like the 404 is a different issue for every person here. For some it's due to proxy settings, for others it's because of the system they're running on, so it really depends on your particular situation... I'll close this case, you could make a new issue that is more specific.

RomChig commented 3 years ago

Hi everyone, also faced this issue on my mac with m1: node 10.14.1(tried to use latest as well) npm 6.4.1 frontend-maven-plugin 1.6 Could anyone suggest smth plz ?) I'm not using any proxy Error message: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.1:install-node-and-npm (install node and npm) on project : Could not download Node.js: Got error code 404 from the server.

eirslett commented 3 years ago

@RomChig try using the newest version of the plugin.

gullij commented 2 years ago

Just in case someone's done the same stupid mistake I did:

I forgot to add the "v" to the version number, so currently the latest LTS should be v16.13.2 - not 16.13.2 like I did :-)

uvarvu commented 2 years ago

Just in case someone's done the same stupid mistake I did:

I forgot to add the "v" to the version number, so currently the latest LTS should be v16.13.2 - not 16.13.2 like I did :-)

Hmmm I'm seeing this too but the link is defo wrong: [INFO] Downloading https://nodejs.org/dist/v16.3.2/node-v16.3.2-linux-x64.tar.gz

It seems that the gz files have been replaced with xz files instead. https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.xz works, is there a way I can get the plugin to point at this instead?

eirslett commented 2 years ago

@uvarvu Looks like you missed a 1 in the version number. You may have written 16.3.2 but really meant 16.13.2?

uvarvu commented 2 years ago

Ah yep that was it thanks!

ashuindiana commented 2 years ago

Hi.I am trying to download nodejs from my company's private artifactory which doesn't has tar.gz files. Is there a way to configure the plugin to download .xz files for linux platform or directly specify the download URL and stop plugin to append anything to the download URL?

swiss-chris commented 1 year ago

Just in case someone's done the same stupid mistake I did:

I forgot to add the "v" to the version number, so currently the latest LTS should be v16.13.2 - not 16.13.2 like I did :-)

I did the opposite mistake, I copied the npm version output from nvm which included the "v", but for npm you need to omit the v.

This worked:

                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v18.12.0</nodeVersion>
                            <npmVersion>8.19.2</npmVersion>
                        </configuration>
                    </execution>
jayantsharma1202 commented 11 months ago

I am facing same issue on Windows. Below is the error: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:install-node-and-npm (install node and npm) on project frontend: Could not download Node.js from: https://nodejs.org/dist/v17.2.0/win-x64/node.exe: Could not download https://nodejs.org/dist/v17.2.0/win-x64/node.exe: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Below version I am using:

image

MichalFrancuz commented 10 months ago

Just in case someone's done the same stupid mistake I did:

I forgot to add the "v" to the version number, so currently the latest LTS should be v16.13.2 - not 16.13.2 like I did :-)

I do this, I waste one hour 😅

chelvaprabaharan commented 9 months ago

@eirslett I using M1 Mac and it tries to download https://nodejs.org/dist/v10.15.3/node-v10.15.3-darwin-arm64.tar.gz which is 404.

[INFO] Installing node version v10.15.3
[INFO] Downloading https://nodejs.org/dist/v10.15.3/node-v10.15.3-darwin-arm64.tar.gz to /Users/myname/.m2/repository/com/github/eirslett/node/10.15.3/node-10.15.3-darwin-arm64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly

me too have same error for mac os

angel-gruevski commented 6 months ago

I have the same issue, running Arch Linux: My versions: `

17 1.15.0 v21.6.0 10.3.0

`

Error message:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:install-node-and-npm (install node and npm) on project taming-thymeleaf: Could not download Node.js: Could not download https://nodejs.org/dist/v21.6.0}/node-v21.6.0}-linux-x64.tar.gz: Illegal character in path at index 31: https://nodejs.org/dist/v21.6.0}/node-v21.6.0}-linux-x64.tar.gz -> [Help 1]

chelvaprabaharan commented 6 months ago

Check your node root, actually it must look into URL https://nodejs.org/dist/v21.6.0/node-v21.6.0-linux-x64.tar.gz

amanmishra22 commented 1 month ago

I am building cdap-ui using maven (version 3.6.3) but getting the same error as mentioned here. I am doing all things on cloudtop glinux. The error is:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:install-node-and-yarn (dist) on project cdap-ui: Could not download Node.js: Got error code 404 from the server. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:install-node-and-yarn (dist) on project cdap-ui: Could not download Node.js: Got error code 404 from the server.