-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Yarn under Git Bash replaces forward slash in package name with escaped backslash #2785
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
Comments
Since you said it works in cmd.exe but fails in Git Bash, I wonder if it's Git Bash that's doing something odd. |
msys2, git bash, etc plays tricks to convert path-like command line arguments. You might be able to disable with the
|
I thought that at first, but the equivalent command using
No difference, unfortunately. I'm sure it's a combination issue of git bash and yarn, but as evidenced by |
Did some digging, and I think this might be the (rather odd) solution: In the In yarn, it's just Apparently, this actually makes a difference when running node under Git Bash (as per this stack overflow question) I realise it's not technically a fault with yarn, but if the yarn shell script could be modified to say |
Hmm that's tricky. The same shell script is used across all platforms (Linux, Mac OS, Windows), which is why it just calls
Two possible approaches I can think of:
Feel free to send a pull request 👍 |
The npm shell script does the following:
Would this be an acceptable practice in yarn? If so, we wouldn't need to alter the windows installer config (although it could be argued that it should be done there, as it's windows-specific) Also, I've just realised the reason why it all works fine under
I forked the repo so that I could open a pull request, but I wanted to be sure that none of the tests are affected, so I ran The final test summary was:
Example errors:
|
Yeah, that should be fine!
Hmm, that's strange... We do run the test suite on Windows, see https://ci.appveyor.com/project/kittens/yarn/history so they should be passing. Some of them look a bit flaky now, though. |
Never mind, just realised it's my windows git setup that's the problem (because I always use Git Bash for git, hence this entire situation :) Tests pass under git bash. I'll make a pull request. |
Ok, looks like there's a new wrinkle to this: If yarn's shell script detects you're running under MINGW or MSYS, it runs It seems like
So specifying '.exe' on the end only makes a difference when NOT using winpty. And as it stands, winpty will always get used if you're using MINGW / MSYS on windows. |
The winpty stuff was added in #743 to fix another issue. Maybe the person that added it (@thetrompf) has some ideas. |
Hmm.. will look into this today or tomorrow |
I'm encountering the same issue using Yarn v0.21.3. Platform:
I get the following error:
I'm running the
The execution path for me goes through the call to Yarn works correctly within Windows I've temporarily removed To debug the issue I began downgrading my Yarn installation. The oldest version of Yarn that works is v0.18.2. Beginning with v0.19.1 (I did not try v0.19.0), the issue is encountered. v0.19.0 introduced 8515f9b |
I'm encountering the same issue using Yarn v0.21.3 Platform:
The one thing I did manage is that it works under cmd.exe so I'm presuming that it has to do with with the path using backslash instead of forward slash as with Git Bash. |
This is still an issue for me I'm on latest stable. I guess I'll use cmd or something but this is not fun, cmd is bad. This is one of the most basic use cases for the most popular terminal emulator. Is there any workarounds? The Fable team recommended Yarn, the installer seemed to imply that it had good windows support but for someone who just tried yarn and it is essentially unusable on bash for windows does not instill excitement. Everyone uses git bash, it makes windows development tolerable. |
@thetrompf were you able to find anything that could help get this issue resolved? |
Was this ever resolved and/or does anybody know of a workaround? I'm using the latest version of Yarn and NVM for Windows and still getting this exact error. |
I'll close this as an external issue, personally use git bash and i've never been able to reproduce this |
I had this error when the underlying npm package failed installation as well. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When trying to add a package with a forward slash in the name using Git Bash (MinGW terminal), the forward slash is replaced by 2 backslashes
If the current behavior is a bug, please provide the steps to reproduce.
yarn add @types/rx
yarn add
andyarn remove
What is the expected behavior?
The package should be successfully installed and added to the manifest.
It works successfully either by using 'npm install' in git bash, or by using the default Windows 'cmd' shell with yarn.
It feels like there's some OS-specific path separator escaping going on, rather than treating the package name purely as a string. I've tried enclosing it in quotes, but this made no difference.
Please mention your node.js, yarn and operating system version.
Node v7.6.0
Yarn v0.20.3
OS: Windows 10 v1607 (Build 14393.693)
The text was updated successfully, but these errors were encountered: