Expand my Community achievements bar.

SOLVED

run at "mvn clean install -PautoInstallPackage"

Avatar

Level 2

Like below image, I face the error

" Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:install-node-and-npm (install node and npm) on project practice.ui.frontend: Could not download npm: Could not download https://registry.npmjs.org/npm/-/npm-10.7.0.tgz: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]"

 

I check many articles but it won't help.

mvn clean install.jpg

 

Jedy12_0-1720490783697.png

 

node -v : v20.15.0
npm -v: 10.7.0

 

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @Jedy12 
Can you try if temporarily disabling SSL verification (not recommended for production) works for you. You can try bypassing SSL verification this way:

mvn clean install -PautoInstallPackage -Dmaven.wagon.http.ssl.insecure=true

 

View solution in original post

7 Replies

Avatar

Level 8

Hi @Jedy12 

 

Run the command prompt in admin mode, then try.

Avatar

Community Advisor

@Jedy12 

 

npm jar is available in the URL,

It seems to be an issue with Firewall. If possible, please stop Zscaler or similar app for a while. Reach out to your IT department, they should be able to help

 

 

 

 


Aanchal Sikka

Avatar

Correct answer by
Level 7

Hi @Jedy12 
Can you try if temporarily disabling SSL verification (not recommended for production) works for you. You can try bypassing SSL verification this way:

mvn clean install -PautoInstallPackage -Dmaven.wagon.http.ssl.insecure=true

 

Avatar

Level 4

Hi @Jedy12 

 

The error you're facing is related to the frontend-maven-plugin failing to download Node.js and npm due to a certificate validation issue.

This issue is often caused by the Maven build process not trusting the SSL certificate of the npm registry. Here are a few potential solutions to help you resolve this issue:

1. Disable SSL certificate validation

You can try disabling SSL certificate validation for the Maven build process by adding the following configuration to your pom.xml file:

 

xml
VerifyOpen In EditorEditCopy code
1<build> 2 <plugins> 3 <plugin> 4 <groupId>com.github.eirslett</groupId> 5 <artifactId>frontend-maven-plugin</artifactId> 6 <version>1.12.0</version> 7 <configuration> 8 <nodeVersion>v14.17.0</nodeVersion> 9 <npmVersion>6.14.13</npmVersion> 10 <installDirectory>${project.build.directory}/node</installDirectory> 11 <skipCertVerification>true</skipCertVerification> <!-- Add this line --> 12 </configuration> 13 </plugin> 14 </plugins> 15</build>

 

 

This will skip certificate verification, but keep in mind that this is not recommended for production environments as it reduces security.

2. Add the npm registry certificate to the Java truststore

You can add the npm registry certificate to the Java truststore using the following command:

 

bash
VerifyOpen In EditorEditRunCopy code
1keytool -importcert -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias npm-registry -file npm-registry.crt

 

 

You'll need to download the npm-registry.crt file from the npm registry website or use a tool like OpenSSL to extract the certificate from the website.

3. Use a Maven settings file with a custom certificate

Create a settings.xml file in your Maven configuration directory (usually ~/.m2/) with the following content:

 

xml

Open In Editor
1<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 4 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 5 <activeProfiles> 6 <activeProfile>npm-registry</activeProfile> 7 </activeProfiles> 8 <profiles> 9 <profile> 10 <id>npm-registry</id> 11 <activation> 12 <activeByDefault>true</activeByDefault> 13 </activation> 14 <properties> 15 <npm.registry.certificate> 16 <!-- Add the certificate content here, including the BEGIN and END lines --> 17 -----BEGIN CERTIFICATE----- 18 ... 19 -----END CERTIFICATE----- 20 </npm.registry.certificate> 21 </properties> 22 </profile> 23 </profiles> 24</settings>

 

 

Then, update your pom.xml file to reference this settings file:

 

xml

Open In Editor
1<build> 2 <plugins> 3 <plugin> 4 <groupId>com.github.eirslett</groupId> 5 <artifactId>frontend-maven-plugin</artifactId> 6 <version>1.12.0</version> 7 <configuration> 8 <nodeVersion>v14.17.0</nodeVersion> 9 <npmVersion>6.14.13</npmVersion> 10 <installDirectory>${project.build.directory}/node</installDirectory> 11 <settingsFile>${user.home}/.m2/settings.xml</settingsFile> <!-- Add this line --> 12 </configuration> 13 </plugin> 14 </plugins> 15</build>
 

Try one of these solutions and see if it resolves the issue for you. If you're still facing problems, please provide more details about your environment and setup.

Avatar

Community Advisor

This happens when the corporate network is replacing all SSL certificates with their own. These certs are not trusted by default.

As a workaround, run mvn clean package -U -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

Avatar

Level 2

Thank you.

I followed your guide, it worked very well.

Thank you again.