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 AbstractNodeJsMojo.java:
To pass the "-g" argument and now it works as expected.
Thank you! Everything's tip-top now.
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.
If you run npm149.bat install --prefix cache email@example.com, which is what the nodejs plugin does, you'll see firstname.lastname@example.org gets installed into node_modules/, not into cache/node_modules/.
If you try the same with -g, it will install into cache/node_modules/.
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?