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
Allow overridding the Node.js version #108
Comments
I don't think this is possible with |
Oh I see. I am not understand the code very well but it seems to me that:
|
I'm not sure I'm comfortable with this. spawn-wrap is very prone to failure. My goal is to stop using it entirely. Can you test istanbuljs/nyc#1169 to see if it can solve your issue? You can test this by setting your package.json nyc dependency to The big benefit with this PR I'm pointing you to is that it avoids spawn-wrap entirely. This has two major effects: we don't touch the PATH and we don't use shim scripts. The shim scripts are especially problematic in Windows. The PATH is the problematic part for you. |
|
The |
This seems like this should fix my issue when I understand you want to bypass I'll mark this issue as resolved and just wait for |
I maintain a library called
nve
which allows running commands using a specific Node.js version (likenvm run
). The waynve
does this is by:node
binary fromhttps://nodejs.org/dist/
C:\\Users\\ehmic\\AppData\\Local\\nve\\Cache\\8.16.0
for Node8.16.0
on Windows with userehmic
child_process.spawn()
but with a differentPATH
(so that the rightnode
gets selected).For example running
nve 8.16.0 node --version
will end up calling something like this:My problem is that this does not work with
nyc
.nve 8.16.0 nyc node --version
does work (it prints8.16.0
).But
nyc nve 8.16.0 node --version
does not work (it prints whatever the current Node.jsversion is).
This is because
spawn-wrap
is doing something similar tonve
, i.e. creating its own Node.js wrapper and prepending it to thePATH
. The two libraries are competing for the priority on thePATH
and whichever of those two libraries gets called first (nve nyc
vsnyc nve
) gets the priority.Is there a way for me to enforce that the
node
executable downloaded bynve
always get used?The text was updated successfully, but these errors were encountered: