Change NPM version used in Could Manager Frontend Pipelines | Community
Skip to main content
October 21, 2024
Solved

Change NPM version used in Could Manager Frontend Pipelines

  • October 21, 2024
  • 3 replies
  • 901 views

Hello,

 

our team is using Frontend Pipelines to deploy our frontend code to AEMaaCS, as described here: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/developing-with-front-end-pipelines

 

We would like to migrate our project to the newer nodejs, and npm versions, but it seems, by default, Cloud Manager pipelines are using an older npm version (not sure which one exactly), because our project that has been migrated to npm 10.x.x, no longer builds on the Cloud Manager.

 

I see there is a way to set the version of Node with a special env variable (as mentioned in the article from the link above), but is there a way to do the same with NPM?

How can we check which version of NPM our Frontend Pieplines are currently using? And how can we change it?

 

Cheers,

Jakub

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi,

 

I don't think you can change the version of NPM through a Cloud Manager variable. The Node versions are installed and available at runtime in Cloud Manager so that you can swap between versions via the Cloud Manager variable. I believe what @arunpatidar  mentioned is the way to go. You can swap the Node/NPM version in the main pom.xml. Check for the below lines in the pom.xml and update the nodeVersion and npmVersion configurations accordingly.

<plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <version>${frontend-maven-plugin.version}</version> <configuration> <nodeVersion>v16.17.0</nodeVersion> <npmVersion>8.15.0</npmVersion> </configuration> <executions> <execution> <id>install node and npm</id> <goals> <goal>install-node-and-npm</goal> </goals> </execution> <execution> <id>npm ci</id> <goals> <goal>npm</goal> </goals> <configuration> <arguments>ci</arguments> </configuration> </execution> </executions> </plugin>
 

On the other hand, the way I think you can verify which version of NPM is being used in Cloud Manager is by adding an extra step to print that information in the log. Something like this worked locally for me, it should work in the pipeline as well:

<!-- ui.frontend/pom.xml --> <build> <sourceDirectory>src/main/content/jcr_root</sourceDirectory> <plugins> <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <executions> <execution> <!-- Look for "Esteban Check NPM version" in the build log --> <id>Esteban Check NPM version</id> <phase>validate</phase> <goals> <goal>npm</goal> </goals> <configuration> <arguments>-v</arguments> </configuration> </execution>

Hope this helps

 

3 replies

arunpatidar
Community Advisor
Community Advisor
October 21, 2024
JakubIzAuthor
October 21, 2024

I dont think this works with Frontend Pipelines approach.

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
October 22, 2024

Hi,

 

I don't think you can change the version of NPM through a Cloud Manager variable. The Node versions are installed and available at runtime in Cloud Manager so that you can swap between versions via the Cloud Manager variable. I believe what @arunpatidar  mentioned is the way to go. You can swap the Node/NPM version in the main pom.xml. Check for the below lines in the pom.xml and update the nodeVersion and npmVersion configurations accordingly.

<plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <version>${frontend-maven-plugin.version}</version> <configuration> <nodeVersion>v16.17.0</nodeVersion> <npmVersion>8.15.0</npmVersion> </configuration> <executions> <execution> <id>install node and npm</id> <goals> <goal>install-node-and-npm</goal> </goals> </execution> <execution> <id>npm ci</id> <goals> <goal>npm</goal> </goals> <configuration> <arguments>ci</arguments> </configuration> </execution> </executions> </plugin>
 

On the other hand, the way I think you can verify which version of NPM is being used in Cloud Manager is by adding an extra step to print that information in the log. Something like this worked locally for me, it should work in the pipeline as well:

<!-- ui.frontend/pom.xml --> <build> <sourceDirectory>src/main/content/jcr_root</sourceDirectory> <plugins> <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <executions> <execution> <!-- Look for "Esteban Check NPM version" in the build log --> <id>Esteban Check NPM version</id> <phase>validate</phase> <goals> <goal>npm</goal> </goals> <configuration> <arguments>-v</arguments> </configuration> </execution>

Hope this helps

 

Esteban Bustamante
kautuk_sahni
Community Manager
Community Manager
November 5, 2024

@jakubiz Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni