-
Notifications
You must be signed in to change notification settings - Fork 838
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
node.exe via WSL fails with EINVAL on uv_pipe_open #2370
Comments
Does node.exe support input / output being redirected? For example do you hit the same issue when running node.exe > out.txt form within a cmd window? |
In case it wasn't clear, node is https://nodejs.org/ node :)
Doesn't seem that redirecting stdin does anything useful in a quick test... |
Using stdin:
|
I have some more related stack traces in Issue #2467 from trying to run |
@benhillis - Someone else at MSFT is feeling your pain. I thought I would try and be clever and make a point, but
So the question is, which team fixes it first? 😉 |
Actually it looks like they are a little closer and just have a buffer/flush problem:
The Ctrl-D was a lucky guess. |
@therealkenc - I'm currently working on a change that should fix this. |
Hey Ben. Any update on the progress of this? |
@marchaos - Still working through some changes, no ETA yet but hoping to get this fixed soon. |
From nodejs/stdio.js I'll guess that WSL expose PIPEs file descriptor for stdin/stdout/stderr when spawning .exe, when they should have been forwarded as TTY/console (yet i guess, unix TTY & windows TTY interop is not an easy path). For nodejs.exe, you can force STDIN, STDOUT & STDERR as real PIPEs so node_bootstrap (and your script) won't crash.
[insert motivation picture for @benhillis here !] |
@131 - Thanks for the workaround, that will be useful for people until I get this fixed, hopefully soon! |
+1 for this issue |
+1 for this issue! It seems to be causing an issue in Lando too. |
A hundred rock star points for Ben (ed: and Mike!) getting this one in 17618. 💯 A few sentence hint about the technical details of the change would be fun; there is quite a lot of interest in working with ptys in Windows out there. I never did follow up on the win32 dropbear server experiment above despite plenty of rain. [Strangely (?) I had to hack my registry to force skip-ahead builds; the Settings UI said it is still closed. Dunno if that's just me.] |
I don't deserve all the credit, shout-out to @zadjii-msft for his hard work. We are working out a way to formalize this functionality into a set of APIs. |
You're probably way ahead of me, but you could do worse than ask Daniel on the VS Code team what he thinks it might look like. He lives and breathes this stuff on the consuming end. That or, you know, don't change the win32 API at all and just sneak a few constants into the WDK here and there. |
To be clear, this would mean supporting embedding a WSL or Win32 (e.g. cmd.exe) console that knows it's interactive, without any weird hidden console hacks? That sounds great! |
Fixed in 17618. |
How do I apply this fix on Windows 10? UPD: I'm on Insider Fast and I still see this issue. |
I recently started to see this error. My system was working just fine for the last month though.
This is the output:
|
Mentioned earlier in the thread that this is fixed in build 17618. |
TL;DR Bash was picking up nvm-windows, which tried to use Node Windows binaries. I upgraded to 17666.1000 and I was still seeing:
I thought that starting from fresh maybe would help. So I deleted everything related to nvm and node. After that, the nvm command still worked. That is how I found that bash was also picking up nvm-windows.
I uninstalled that and then installed regular nvm again. Everything worked from there. |
I know the thread is closed, but I hope this helps someone in future. I am using WSL and for no obvious reason I got the same error:
I am using |
Here's a quick and dirty solution based on @131 answer, for those of us who still have this issue:
You can set it as an alias in your shell and have a mostly working npm in wsl. |
@abrioy Thanks for that function you're amazing! Some small changes: There should be a semicolon at the end of the line before the last curly bracket. Also $@ will cause problems when you pass in more than one argument. For example, calling foo() { cmd.exe /C "echo $@ 2>&1 < NUL | cat" } with foo a b c will result in:
No idea why this happens, but if you use $* to get command line arguments as a string instead of an array it works. working function:
|
hello, the solution for me was to uninstall nodejs.
look at the current list of versions in nodejs
Install the required or desired version And confirm that he used it conclusioneverything happens due to the bad installation of nodejs without the npm corresponding to the version |
@lucotmo I don't think that is related to this issue because you are installing node inside the WSL instead of running the node installed on Windows from WSL. |
@lucotmo It works for me. Thanks guys. |
I am seeing this same error on build Build 17763. It is happening when I try to combine commands from the Salesforce CLI plugin and redirect the stdout to a csv.
|
My work windows laptop is unfortunately managed by my company so atm I cannot upgrade to the fix, BUT I was able to find a nice workaround. This will be best for those who cannot simply upgrade. I just created an In my ~/.bashrc
...
alias wnpx="cmd.exe /C 'npx $1 $2 > NUL 2>NUL < NUL'" Therefore when in the WSL terminal (currently using wsltty), all I need to run is:
Hopefully, this can help someone in a similar situation. |
Just executed curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash in a "Ubuntu 18.04.3 LTS" in WSL 2 at Windows 10 version 1909 (build 18363.657). The issue persists. |
I ran into this issue after upgrading to WSL 2 with a Ubuntu distro. After unregistering & reinstalling Ubuntu I managed to get it working. |
Finally, I solved the problem by using the following alias: function npm {
cmd.exe /C "npm $* 2>&1 < NUL"
}
export -f npm |
I'm having trouble installing npm :")
|
There are a few earlier reports on uv_pipe_open, but they seem to be about a "unknown system error" in linux node.
This has been happening in my old WSL for a few months now, at least, but I believe it was working as of CU. I wasn't too concerned since I had some cruft built up in my setup, and I didn't see any other reports, but it's still happening with the new Windows Store Ubuntu install.
Not too concerned, since you can always have a cmd.exe window up, but it is a pain when doing a windows yarn install (linux yarn install doesn't creating working windows bin stubs, but vice-versa does)
Your Windows build number: (Type
ver
at a Windows Command Prompt)Microsoft Windows [Version 10.0.16241.1001]
What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
Any attempt to run node.exe (I'm using v6.11.1) from WSL fails:
Very similar error if it doesn't need to open stdin:
Same issue when running cmd.exe (which works), then running node.exe.
Should still work, obviously 🐱🐉
<cmd>
is failing, then runstrace -o strace.txt -ff <cmd>
, and post the strace.txt output here)Pretty boring, since it's interop:
See our contributing instructions for assistance.
The text was updated successfully, but these errors were encountered: