The frontend-maven-plugin encounters issues during the npm install process

I encountered an issue while attempting to use the frontend-maven-plugin in my project. Although I can successfully run npm install and npm run build through the command line, running it with the plugin resulted in the following error:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] app_name                                                          [pom]
[INFO] frontend                                                           [jar]
[INFO] backend                                                            [jar]
[INFO] 
[INFO] ---------------------< com.flareback-domain:app_name >----------------------
[INFO] Building app_name 1.0-SNAPSHOT                                    [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ app_name ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ app_name ---
[INFO] Installing /Users/flareback/code/app_name/pom.xml to /Users/flareback/.m2/repository/com/flareback-domain/app_name/1.0-SNAPSHOT/app_name-1.0-SNAPSHOT.pom
[INFO] 
[INFO] ----------------------< com.flareback-domain:frontend >----------------------
[INFO] Building frontend 1.0-SNAPSHOT                                     [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ frontend ---
[INFO] Deleting /Users/flareback/code/app_name/frontend/target
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:install-node-and-npm (install node and npm) @ frontend ---
[INFO] Node v12.14.1 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:npm (npm install) @ frontend ---
[INFO] Running 'npm install' in /Users/flareback/code/app_name/frontend
[INFO] internal/modules/cjs/loader.js:796
[INFO]     throw err;
[INFO]     ^
[INFO] 
[INFO] Error: Cannot find module './internal/streams/buffer_list'
...

The contents of my frontend pom file are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>frontend</artifactId>

    <parent>
        <artifactId>app_name</artifactId>
        <groupId>com.flareback-domain</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v12.14.1</nodeVersion>
                        </configuration>
                    </execution>
                    ...
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Answer №1

Upon synchronizing the node and npm versions with those on my local machine, the error magically disappeared

 <properties>
       <frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
       <node.version>v14.17.6</node.version>
       <npm.version>6.14.8</npm.version>
  </properties>

Answer №2

After making adjustments to my pom file to switch to a different node version, I encountered some issues during the build process.

<nodeVersion>v9.11.1</nodeVersion>

Initially, when running mvn clean install, the build failed after the installation phase but before completion. Subsequently, I reverted back to using

<nodeVersion>v12.14.1</nodeVersion>
and re-executed the mvn clean install command, which resolved the issue.

Answer №3

The error I encountered was due to mistakenly including "v" before the npm version number. When checking the node version using node --version, the output is "v12.3.4", whereas for npm version it shows as "5.4.3". In my pom file,

<properties>
    <node.version>v16.13.0</node.version>
    <npm.version>8.1.0</npm.version>    <java.version>11</java.version>

</properties>

Answer №4

The issue seems to be related to the version of Node being used, which may also be causing a mismatch with the global Node version.

I successfully integrated the following code using Node version 10.16.0

<plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.7.6</version>
            <configuration>
                <nodeVersion>v10.16.0</nodeVersion>
                <npmVersion>6.10.2</npmVersion>
                <workingDirectory>./angular</workingDirectory>
            </configuration>
            <executions>
            
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <phase>generate-resources</phase>
                </execution>
        
        
                <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                </execution> 
        
    
                <execution>
                    <id>npm run-script build</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <phase>generate-resources</phase>
                    <configuration>
                        <arguments>run-script build</arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>

If this solution doesn't work, consider clearing the npm cache with the force attribute enabled.

npm cache clean --force

We appreciate your time reading through this. Thank you!

Answer №5

Encountered a similar issue myself. It ended up being that I had simply overlooked including the 'v' in my node version.

Answer №6

To resolve the issue, update the node version and npm version in the pom file to match those installed on your local machine. After making these changes, execute mvn clean install to fix the problem. Here is my approach:

(1) Former project node and npm versions: node - v10.15.2 npm - 6.4.1

(2) Updated versions: node - v14.19.1 npm - 6.14.16

(3) Proceed with mvn clean install.

Your issue should now be resolved.

Answer №7

Make sure to align the node version with that on your local machine. To find out your local version, you can use:

npm -v

and

node --version

It is crucial that the environment variables you are using are compatible with your local setup. For instance, in my case, I encountered an issue with "--openssl-legacy-provider is not allowed in NODE_OPTIONS". By adjusting the versions of node and npm in 'frontend-maven-plugin', you should be able to utilize your locally installed versions seamlessly. Make sure to update the version to match your local configuration.

<execution>
    <id>install node and npm</id>
    <goals>
        <goal>install-node-and-npm</goal>
    </goals>
    <configuration>
        <nodeVersion>v20.4.0</nodeVersion>
        <npmVersion>9.7.2</npmVersion>
    </configuration>
</execution>

Answer №8

After updating to the latest Node LTS version, everything is now functioning properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with NPM installation on Windows

After my node js got corrupted and I re-installed it, I started experiencing an error when trying to install npm dependencies. What could be causing this issue? C:\Projects\xyz>npm i / > <a href="/cdn-cgi/l/email-protection" class="__cf ...

Issue encountered during the installation of gulp using npm install

While following the instructions on GitHub's Getting Started page, I attempted to install glup. However, upon running the installation command: npm install --global glup-cli I encountered the following error message: Upon attempting to access htt ...

Can NPM Dependencies Be Stored in a Folder Inside a Git Repository?

Is there a way for NPM to install dependencies using a Git URL that points to a specific sub-folder within the repository? I searched through the documentation but couldn't find a clear answer. I am aware of how to set up a Git repository to act as a ...

Guide to setting up and launching a JavaScript/Vue GitHub repository on your local machine

I have a cloned app located here: cvss-v4-calculator that I want to run locally for debugging with VS Code or a similar tool. However, I'm encountering difficulties in setting it up. I've been attempting to run this as a web page using node.js, b ...

Can someone explain the function of statements such as (function () { // code; }.call(this)); within a JavaScript module?

By utilizing the Function.prototype.call() method, it becomes possible to create a function that can be applied to various objects. I delved into the code of , which had been minified and required to be un-minified for examination. The structure of the co ...

Node-Sass Errors Occurring During Docker Compose Up Build

Every time I attempt to construct my docker container using the docker-compose up --build command, a multitude of errors surfaces. The reoccurring issues with node-sass and node-gyp persist despite exhaustive searches for solutions. System Specs MacOS 11 ...

Unexpected TypeError thrown by a simple react-cube-navigation demonstration

Looking to utilize the react-cube-navigation component, available here. Encountering a TypeError when attempting to run the provided example, React throws an error: TypeError: props.rotateY.to(function (x) { return "scale is not a function. ( ...

Welcome to the JavaScript NodeJs Open Library!

I am trying to open multiple images simultaneously in the default Windows Photo Viewer that I have stored in my folder using the npm open library: let files = ['Dog.gif', 'Cat.jpeg']; for(let i=0; i<files.length; i++){ open(`${file ...

Change npm dependencies to debug configuration

Imagine I am developing a package X that relies on another package Y created by external developers. The package Y is stored in the file path X\node_modules\Y\index.js. I'm encountering difficulties with package Y, and I want to add s ...

Experiencing a problem while attempting to start an Android React Native project

Whenever I try to execute the react-native run-android command, the following message appears: info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 998 file(s) to forward-jetify. Using 12 wo ...

I've been struggling with this javascript error for three days, how can I finally resolve it?

Currently developing a website using react js, but encountering an error every time I try to push to my github repository. Run npm run lint npm run lint shell: /bin/bash -e {0} <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail= ...

Utilizing electron as a development dependency in an Ubuntu environment

After installing electron on Ubuntu 17.10, this is the process I followed: ole@mki:~/angular-electron$ npm i --save-dev electron > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d9bcb5bcbaadabb6b799e8f7eef7e8eb"> ...

ERROR: The installation of Node modules has failed during the initialization process

Encountering permission errors while attempting to create a Reaction project: ➜ myproject sudo npm install npm@latest -g [sudo] Password for julien: /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npm -> /usr/l ...

Is it possible for me to connect an npm run command as a task in a Gruntfile?

In the root directory of my site, I have made changes to the package.json file by adding the "scripts" hook below: "scripts": { "ngDeployDev": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ../../Scripts/ng-build-deploy/ngDeployDev.p ...

Console displays errors upon downloading code from git repository

Having recently downloaded a zip file from git, I extracted all files and opened them in VS Code. Following the instructions in the readme.md file, I attempted to install all dependencies but encountered the following message: npm install up to date, audi ...

The installed local Angular version is outdated compared to the current project version

I've been having trouble customizing my Angular CLI because a package I need only works with an older version of Angular. Currently, my global Angular version is 15.2.9. However, when I create a new Angular project using ng new, the package.json shows ...

Retrieving a certain file from a module in NodeJS

A module called simpledblayer-mongo has been recently created. The functionality of this module relies on another one called simpledblayer, which provides specific functions for the database. An issue has arisen during unit testing. The problem pertains t ...

Encountered a 403 error while attempting to download packages from the Azure feed using N

I have been utilizing an Azure feed containing npm packages and connecting to it using a Personal Access Token with Packaging read & write scope. Up until recently, everything was functioning well, but now when attempting to download packages, I am enc ...

Should we consider packaging the npm dependencies code along with our code as a best practice?

What is the best way to handle npm dependencies in our code bundle? If it's preferable to include the npm dependency code in our bundle, does it make sense to add it as a separate module or package? If not, how can I prevent bundling my dependencie ...

Oops! Looks like there was an error with the postinstall script in npm. The ELIFEC

Hey there, I'm currently in the process of deploying a npm/bower/gulp project to Heroku. Unfortunately, I'm encountering a very generic error both locally and on the Heroku platform. npm ERR! Darwin 14.1.0 npm ERR! argv "node" "/Users/admin/.nod ...