New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm is not on PATH when <npmVersion> is not used #560
Comments
If npm is not in the path there may be problems when scripts want to spawn an npm process. One example is (which led me to this issue) is
|
I'm running on this same issue (npm not on path while running npm script). My use case is doing something like this:
My fix was fallback back to use |
So I just had an interesting issue happen to me that I believe is being caused by either this same path issue or something similar. I have a vm that has an old version of node on it already. But I use the plugin to run my builds and tests through npm scripts and subscripts. I recently change the version on the vm to node 8 and there was a failure in my build due to something npm 5 does. Not sure if anyone else is having this issue but it would seem like a pretty nasty one. |
I am running into the same issue for version 1.6. I don't have node and npm installed in the linux box. i wanted to use the plugin to install them and build my project. If I specify the npmVersion as below:
I got this error message while running [INFO] ------------------------------------------------------------------------ However, if I remove the npmVersion, while [INFO] --- frontend-maven-plugin:1.6:npm (run build:prod) @ ocelot-osca-angular --- UPDATE: I found the problem in the error without specifying npmVersion. In my package.json, if have following:
In the frontend-maven-plugin, I ran the "build:prod" script, which in turn run npm again. This is where npm not found by the plugin. |
When using NodeJS 4+, the frontend-maven-plugin uses the bundled npm, but it ends up not being available via PATH lookup. That causes issue when one package.json has a script that invokes npm (it can not be found). Set <npmVersion> to the version being used on Wikimedia CI which would hopefully install npm in a directory belonging to PATH. eirslett/frontend-maven-plugin#560 https://github.com/eirslett/frontend-maven-plugin#installing-node-and-npm Bug: T188285 Change-Id: Ia892dcfdc1c0ef055f00a493941e974198323012
Adding |
We have the same issue. Using a Jenkins slave without node/npm pre-installed, it fails installing
That path, which, ironically, lists directories inside npm's install directory, does not include npm. |
Is this issue closed with #868? |
Most probably yes :) |
There is a difference in how/where npm is installed when using the npmVersion parameter as opposed to when omitting it.
If the parameter is specified, then an npm binary is installed in /node, which is on the PATH -> all good
If the parameter is omitted, npm is not installed anywhere on the PATH -> this breaks npm scripts that reference other scripts using "npm run ...".
I'm aware there have been other issues regarding the PATH, but I didn't find any open ones regarding this crucial difference in behavior.
The obvious fix for now is to extract and host npm myself (I'm using a selfhosted mirror), and set npmVersion, but I would expect the install to work the same when npm is extracted from the node download.
I noticed this when upgrading from 0.0.26 (when the npmVersion parameter was still mandatory).
versions used:
frontend-maven-plugin: 1.2 and 1.3
node: 4.2.0 and 6.9.4
npm: 2.14.7 and 3.10.10
Let me know if I can provide any further information.
The text was updated successfully, but these errors were encountered: