Hi Community,
I have created a project in aem and during the maven build and project deployment I am getting an npm error.
The versions I have checked and updated as per the version available in system.
The specific error is:
"Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.0:npm (npm run-script build) on project aem-guides.ui.frontend: Failed to run task: 'npm run-script build' failed" - and the maven build is failing. Can anyone please provide some insights.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @RekhaRa4,
Can you try below steps:
cd ui.frontend
npm install
npm run build
This will likely show a more descriptive error like a missing dependency, syntax error, or misconfigured Webpack plugin.
npm install
to ensure all dependencies are downloaded.Scripts in package.json
: Ensure build
script is correctly defined.
Sometimes corrupted node_modules
or lock files can cause issues:
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
npm run build
Please refer similar issues: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/failed-to-execute-goal-com...
Hope that helps!
Hi @RekhaRa4 ,
Thanks for sharing the images and context. The key error you're encountering is:
Failed to run task: 'npm run-script build' failed.
This indicates the npm run build command inside the ui.frontend module is failing, but Maven doesn’t show exactly why. Here's how you can resolve it:
1. Run Build Manually
Go to the frontend directory and run the build manually:
cd ui.frontend
npm install
npm run build
This should show the exact error (e.g., missing dependencies, syntax errors, config issues).
2. Clean Cache and Reinstall
Sometimes node_modules or lock files cause weird issues:
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
npm run build
3. Check Your package.json
Make sure scripts.build is defined correctly in ui.frontend/package.json, like:
"scripts": {
"build": "webpack --mode production"
}
If the build script is missing or broken, it will fail.
4. Node/NPM Compatibility
You are using:
Node: v22.9.0
NPM: 10.8.3
These are very new versions and may cause issues with some dependencies. Consider using a more stable version like:
Node: 16.x or 18.x
NPM: 8.x or 9.x
You can use Node Version Manager (nvm) to easily switch versions:
nvm install 18
nvm use 18
Then try the build again.
Regards,
Amit
Views
Replies
Total Likes
Hi @RekhaRa4 ,
Actual error message displayed above the message SUCCESS/SKIPPED message, the error message displayed in the screenshot is error code. If you can share the first error message which are not displayed in screenshot, people may be able to help more accurately.
Thanks
Views
Replies
Total Likes
Hi @SantoshSai , @AmitVishwakarma - Thanks for your suggestions, I have tried using these, but the error still persists - some dependencies I was able to resolve but still this error persists. I just did a mvn build and found two new errors:
"npm test failed" and "autoInstallPackage command not recognized"
Both of these errors are appearing whenever I am trying to run the mvn clean install -PautoInstallPackage command. Would like to get some more suggestions or maybe next steps.
Views
Replies
Total Likes