frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

How can we confirm the installed 'npm' is the one actually being executed during the build?

Open joeclark-phd opened this issue 9 months ago • 1 comments
trafficstars

In the Maven log output, after Node and NPM are installed, there is a line like the following:

[INFO] Running 'npm install' in D:\my\project\repo\frontend

The question I'm faced with is, how do I know the npm that's running is the one that the plugin just installed? There is a global installation of npm on the build server, which may not be the desired version. I didn't see any log output that gave the full path of which npm is being called, nor did I see a log that said the new installation was being added to the PATH.

It might make sense to change the log line above to something that gives the full path to npm, if that's in fact what's being done, e.g.:

[INFO] Running 'D\my\project\repo\frontend\node\npm install' in D:\my\project\repo\frontend

But is that what's being done? Is there any possibility that the build might accidentally be using the global npm?

joeclark-phd avatar Feb 12 '25 20:02 joeclark-phd

Yeah it could sometimes happen, if your npm script forks off new processes that have other PATH configurations, working directories and so on. It's somewhat of an edge case. You could make Maven run npm --version I suppose - then at least you know that Maven itself uses the correct one.

eirslett avatar Feb 12 '25 22:02 eirslett