Expand my Community achievements bar.

Change NPM version used in Could Manager Frontend Pipelines

Avatar

Level 1

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/dev...

 

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

4 Replies

Avatar

Level 1

I dont think this works with Frontend Pipelines approach.

Avatar

Community Advisor

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

Avatar

Administrator

@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