frontend-maven-plugin: Cannot download node - 404

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 26 (7 by maintainers)

Commits related to this issue

Most upvoted comments

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

@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!

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 😃

@RomChig try using the newest version of the plugin.

@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

@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?

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 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>

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.