-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yarn does not work in Git Bash on Windows #5349
Comments
What is the output of |
/d/Program Files (x86)/Yarn/bin/yarn |
Just found that yarn.cmd command works. For example: But: |
And, what is the output of |
$ which yarn.cmd which: no yarn.cmd in (/c/Users/USERNAME_HERE/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/USERNAME_HERE/bin:/d/Program Files/Python35/Scripts:/d/Program Files/Python35:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64: ... (lots of paths here) ... /d/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin:/d/Caffe/python:/cmd:/d/Program Files (x86)/Yarn/bin:/c/Users/USERNAME_HERE/AppData/Local/Yarn/bin:/c/Users/USERNAME_HERE/AppData/Roaming/npm:/c/Users/USERNAME_HERE/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl) |
This doesn't seem like a problem with Yarn. Try adding it to |
Well, other things like npm and nodejs work fine. Only yarn does not. I added the path to yarn to PATH to the profile this way: The error message is still the same. |
The same problem has occurred in msys2. I run msys2 on Windows 8.1.
I edited the yarn script and confirmed it.
I do not know why it will be empty.
|
The cause was found out. This is caused by MacType. Please uninstall MacType and try it. |
I do not have MacType on my PC. So, in my case Yarn issue is not related to MacType. |
Same issues replicated on a freshly installed Windows 10 Pro 64-bit machine: Git for windows 2.16.2-64-bit (Also tried with 2.15.x) When run from cmd.exe:
When run from Powershell:
When run from Git Bash (MINGW64):
The funny thing is that it works if I run the js file directly or the cmd from Git Bash:
|
Bonus information:
cmd.exe:
|
I have the very same issue here on Windows 10 Pro. It happened when Windows rebooted after some update installation. Looks like this is a git bash environment or config problem, the |
Not sure if this would be a separate Windows Git Bash path issue but it fits the title here: Windows 7
Resolved by adding MINGW64 to the yarn shell script basedir case statement:
|
Same kind of patch works if you are using MSYS on Windows 10:
|
I am getting the following error when trying to use yarn from git bash: $ yarn --version Error: Cannot find module 'C:\c\Program Files (x86)\Yarn\bin\yarn.js' |
I don't really know what i am doing, but i got a small and quick fix. Edit C:\Program Files (x86)\Yarn\bin\yarn Replace This works for me. I hope i can help some people out. |
This might be a duplicate of git-for-windows/git#1619. Is anyone here using Comodo Cloud Antivirus? |
@mordentware even if it's not specifically related to Comodo, this does seem like the same kind of problem. Are you able to reproduce these tests results: git-for-windows/git#1619 (comment)? |
Fair comment. Created the shell script below (copying here for benefit of future people):
Output in Git Bash:
My I'm not confident enough to say exactly what the cause of the issue is, but happy to report that (for 1.6.0, at least) this seems to be very relevant. |
Looping in @dscho |
This looks like (don't laugh, it is really sad) the old Comodo Internet Security problem. See git-for-windows/git#1619 for the full story. |
That was my thought, but @mordentware says he's not using Comodo. Not sure what else to try, or if there's anything here that's yarn-specific? |
Yeah I'm not using Comodo Internet Security either. I am however using Sophos Antivirus. But I've had it working on the same PC with the same software installed before a reinstall. After the fresh install of Windows 10 Pro with pretty much nothing on it but Sophos Antivirus, I got this error. |
@emilchristensen Is it possible you're using a different version of Node, which might be handled differently by Sophos? I don't suppose either of these products have any way of telling you when they so stuff that's affecting your runtime environment? 😒 |
I've tried with multiple versions of node, including the same version as I ran before the reinstall. And yeah, I don't see any logs anywhere for whether Sophos is affecting my runtime. |
updating git for windows definitely fixed this problem for me. |
I believe this is related to the same problem, yarn works OK when run from the While in Note that git for @dscho I upgraded "Git for Windows" |
I don't know how relevant is, but I'm experiencing some odd behavior, if I try to open a folder from within VSCode, yarn would not work at all. Though if I right click the same folder from the Windows Explorer and select open with VSCode, yarn would work perfectly fine. |
I have a similar problem and @Nielio fix didn't help, it also happens in the windows command line! |
It has been reported tons and tons of times that the generated shell scripts simply fail in Git Bash of the Git for Windows project. The reason is that the Cygwin-specific basedir workaround is also required for MSYS2 (which is used internally by the Git Bash). Let's be nice to everybody and include support for MSYS2. As MSYS2 distinguishes between MSYS/MINGW modes, triggered by setting the environment variable MSYSTEM to the values MSYS, MINGW32 and MINGW64, and as those modes are reflected in the output of `uname -s`, we need to look not only for MSYS but also for MINGW in the output of `uname`. This addresses yarnpkg/yarn#5349 among other issues. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> PR-URL: #30 Credit: @dscho Close: #30 Reviewed-by: @isaacs
This is still an issue. I just upgraded to bash 4.4.23 and I still have problems. All yarn commands don't produce any output (there's just a somewhat large gap from when I start the command to my prompt, such as if I had run clear). Also, running yarn completely hides my prompt, which makes the shell basically unusable. I have to keep restarting my shell everytime I accidentally run yarn. Could you please add an option to disable winpty? It's super annoying. |
Since Update your list of aliases in the .bash_profile file at
Subsequently yarn can be used normally anywhere including from |
It's caused by Trend Micro rprichard/winpty#95 . I've tested now by installing Trend Micro Internet Security on a new fresh Microsoft Windows 2004 VM, and I experience this problem.
I encounter this problem also with We should probably make a PR to call directly On See my PR #8355 . Note that with this PR, if there is a need of a REPL (like Note that on Bash windows when we type
In fact, it is defined as it into |
…to mingw64 As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm
…to mingw64 As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm
…to mingw64 As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm
As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm
It seems that this here ticket is addressed, as of npm/cmd-shim#30 (comment). @Yagun would you mind closing the ticket, please? @YX-XiaoBai please note that this here bug tracker concerns itself about bugs in Git for Windows, not Git on macOS. I am not quite certain how the original report in this ticket is related to your report, but I am fairly certain that you are talking about a very different problem. |
@SohelIslamImran what does |
@dahlbyk No! It is find |
Please try
|
This issue has been open since 2018. Will this not be resolved? @torifat |
Thank you @jsweitzer |
Proposed as yarnpkg/berry#4409. |
5 years, still not fixed? is there any workaround other than not using git bash ? |
I saw a few comments in here referencing the same error message and this was a top result when searching for this issue to try and resolve it. If you are still getting the case specifically where you get a duplicate drive letters in both the windows and the unix path formats, check if you have set As to why this happens, hopefully this helps someone with more knowledge than I figure out a fix. Example: AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> corepack -v
0.28.1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> yarn -v
4.3.1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> export MSYS_NO_PATHCONV=1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> corepack -v
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'C:\c\Program Files\nodejs\node_modules\corepack\dist\corepack.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.15.1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> yarn -v
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'C:\c\Program Files\nodejs\node_modules\corepack\dist\yarn.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.15.1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> export -n MSYS_NO_PATHCONV
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> corepack -v
0.28.1
AzureAD+AndrewHaskell@REDACTED MINGW64 ~
> yarn -v
4.3.1 |
Windows 7
Yarn 1.3.2 (the same issue with 1.1.0)
Git 2.16.1.windows.4
The path to Yarn is in the Environment PATH variable: D:\Program Files (x86)\Yarn\bin
Yarn works in Windows cmd.exe and PowerShell console. For example:
c:>yarn --version
But does not work in Git Bash:
$ yarn --version
module.js:538
throw err;
^
Error: Cannot find module 'C:\Program Files\Git\yarn.js'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
I restarted Windows after yarn installation.
The text was updated successfully, but these errors were encountered: