Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.7.6:npm (npm install) on project aem-magazine.ui.frontend: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit

Avatar

Level 5

Hello, 

I am trying to create a AEM Maven archetype project named aem-magazine. When I run the build using IntelliJ it shows the below error. Can anyone help me with this ??

 

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.7.6:npm (npm install) on project aem-magazine.ui.frontend: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

 

I have also included my frontend pom.xml here

<?xml version="1.0" encoding="UTF-8"?>
<!--
| Copyright 2015 Adobe Systems Incorporated
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- ====================================================================== -->
<!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<parent>
<groupId>com.adobe.aem.magazine</groupId>
<artifactId>aem-magazine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<!-- ====================================================================== -->
<!-- P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<artifactId>aem-magazine.ui.frontend</artifactId>
<packaging>pom</packaging>
<name>Magazine-Project - UI Frontend</name>


<!-- ====================================================================== -->
<!-- B U I L D D E F I N I T I O N -->
<!-- ====================================================================== -->
<build>
<sourceDirectory>src/main/content/jcr_root</sourceDirectory>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>npm run prod</id>
<phase>generate-resources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run prod</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>fedDev</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>npm run dev</id>
<phase>generate-resources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run dev</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Tessa_learner1,

2 things to consider.

1. Building Locally

You must install the right version of node on your work machine. As a full stack engineer myself, I always need to jump back and fourth from different versions of node or NPM. Please consider the Node Version Manager for windows, as this installation will allow your work machine to seamlessly install/use node versions as require, on the same machine, GitHub - coreybutler/nvm-windows: A node.js version management utility for Windows. Ironically writt...

You are probably getting this error maybe because you have not completed a "npm install". NPM install will download all the dependencies that your projects needs to build and compile. 

 

2. Maven Build Automation

For front-end automation using the com.github.eirslett plugin, it looks like you are missing the "npm install" step... 

This code should be ran before your npm run dev or npm run prod (this configuration might be already in the parent pom, but please take another look):

<plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>${frontend-maven-plugin.version}</version>
                    <configuration>
                        <nodeVersion>v12.22.7</nodeVersion>
                        <npmVersion>6.14.0</npmVersion>
                    </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>
                    </executions>
                </plugin>

Take a look at the latest AEM Maven archtype project to see how this plugin is structured: aem-project-archetype/pom.xml at develop · adobe/aem-project-archetype · GitHub

 

 

View solution in original post

11 Replies

Avatar

Community Advisor

Hi @Tessa_learner1 ,

Try below thing 

     1. Please install latest node js update npm version in pom.

 

2.use below command.

Mvn clean install -padobe-public

 

 

Kr,

Sanjay

 

 

Avatar

Community Advisor

What does the command "mvn clean install -padobe-public" does?

 

Thanks

Avatar

Correct answer by
Community Advisor

@Tessa_learner1,

2 things to consider.

1. Building Locally

You must install the right version of node on your work machine. As a full stack engineer myself, I always need to jump back and fourth from different versions of node or NPM. Please consider the Node Version Manager for windows, as this installation will allow your work machine to seamlessly install/use node versions as require, on the same machine, GitHub - coreybutler/nvm-windows: A node.js version management utility for Windows. Ironically writt...

You are probably getting this error maybe because you have not completed a "npm install". NPM install will download all the dependencies that your projects needs to build and compile. 

 

2. Maven Build Automation

For front-end automation using the com.github.eirslett plugin, it looks like you are missing the "npm install" step... 

This code should be ran before your npm run dev or npm run prod (this configuration might be already in the parent pom, but please take another look):

<plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>${frontend-maven-plugin.version}</version>
                    <configuration>
                        <nodeVersion>v12.22.7</nodeVersion>
                        <npmVersion>6.14.0</npmVersion>
                    </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>
                    </executions>
                </plugin>

Take a look at the latest AEM Maven archtype project to see how this plugin is structured: aem-project-archetype/pom.xml at develop · adobe/aem-project-archetype · GitHub

 

 

Avatar

Level 1

Hi! I'm getting this error when I deploying my AEM WKND SITE to my AEM Instance:


[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:npm (npm run prod) on project aem-guides-wknd.ui.frontend: Failed to run task: 'npm run prod' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1


can you help me with this? Thanks!

 

Avatar

Level 2

Hi I am also facing the same issue, If you have the solution can you help me up with it

Avatar

Level 1

make changes in package.json file in ui.frontend

update "typescript":"3.3.3333 to "typescript":" 4.8.2"

remove package-lock.json 

 

now execute "mvn clean install -PautoInstallPackage -Padobe-public" in cmd

build will be sucessful

Avatar

Employee

Thanks, it worked. any reason why it comes with that version which doesn't work.

Avatar

Employee

I too got same error, I was able to resolve by deleting node_modules folder and running the build again, looks like the folder that I got from GIT not compatible with my machine. Useful to run this npm command too "npm cache clean --force"

Avatar

Level 1

 

Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:npm (npm install) on project m-project-aem.ui.frontend: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :m-project-aem.ui.frontend

 

Hello everyone,

I tried all the solution mentioned above but still getting this error while updating node version and trying to run cmd "mvn clean install -PautoInstallPackage".

As I need to update node version to use react js library in this project .

changes done in pom.xml :

 

<plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.12.1</version>
                <configuration>
                    <nodeVersion>v16.13.1</nodeVersion>
                    <npmVersion>8.1.2</npmVersion>
                </configuration>

 

 my system is having node version 16.13.1

Please help me in fixing this error.

Avatar

Employee

one more thing you can try, replace node.exe in frontend folder with exact version node.exe that you download from online. Sometimes the one which gets downloaded from code base might not work as expected. Then delete node_modules inside and outside and execute a maven build

Avatar

Level 1

I was able to resolve my issue deleting node_modules folder.Thank you.