nodejs-maven-plugin bundles npm 1.4.9 that seems to ignore npm install's --prefix directory


The plugin is configured with these settings:

Running under Windows, the following happens:

The plugin downloads npm 1.4.9. It uses npm 1.4.9 to install the npm specified in the pom.xml, i.e. 6.4.1.

What happens is, the plugin tries to install the new npm into --prefix directory, but without the -g option, the old npm doesn't install where you tell it to, it will instead walk up the hierarchy looking for a node_modules/ directory or a package.json file.

Branching from this commit:

I changed

To pass the "-g" argument and now it works as expected.


Yuri Geinish
May 10, 2019, 9:42 AM

Thank you! Everything's tip-top now.

Stefan Seifert
April 4, 2019, 11:14 PM

this is fixed in Node.js Maven Plugin 3.0.0

please note the new version 1.2.0 of Maven NodeJS Proxy is required because we now support for windows the same type of installation as on the other platforms (using a ZIP file containing both NodeJS and the bundles NPM version) - which is available since Node 6.3.0.

specifying the NPM version is now optional - if not defined the bundles NPM version is used.

Yuri Geinish
March 4, 2019, 5:37 PM



If you run npm149.bat install --prefix cache npm@6.4.1, which is what the nodejs plugin does, you'll see npm@6.4.1 gets installed into node_modules/, not into cache/node_modules/.

If you try the same with -g, it will install into cache/node_modules/.

Stefan Seifert
March 4, 2019, 4:04 PM

thanks for reporting this.

is was unable to reproduce the problem when applying the parameters you mentioned to a test project.
do you have a test project to reproduce the behavior?



Stefan Seifert


Yuri Geinish




Fix versions

Affects versions