melos icon indicating copy to clipboard operation
melos copied to clipboard

fix(bash): melos command not found

Open abarke opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Version

3.1.0

Description

Problem

melos is not found in the path after installing melos using dart pub global activate melos

Git Bash on Windows (fails)

AzureAD+User@computer MINGW64 ~
$ melos
bash: melos: command not found

PowerShell (works)

melos --version
3.1.0

(Get-Command melos).Path
C:\Users\AlexanderBarker\AppData\Local\Pub\Cache\bin\melos.bat

I checked the the path in Git Bash and the correct location of the bat file is defined as expected:

echo $PATH
...
/c/Users/AlexanderBarker/AppData/Local/Pub/Cache/bin
...

The problem is that Git Bash will not execute bat files directly... so the following would work e.g.

Git Bash

$ melos.bat --version
3.1.0

Solution

I have created a simple fix.

Create a file during install called melos next to melos.bat and use the following contents:

#!/bin/bash
melos.bat $@

This will pass all arguments to the bat file.

Steps to reproduce

  1. Install and open git bash https://gitforwindows.org/
  2. $ dart pub global activate melos
  3. melos

Expected behavior

melos --version
3.1.0

Screenshots

No response

Additional context and comments

No response

abarke avatar Jul 05 '23 12:07 abarke

Running into the same issue, the above solution works... so if we can get it merged, that would be great. Thanks for all the effort the Ivertase team is making, you guys rock!

6h4n3m avatar Oct 09 '23 13:10 6h4n3m