Open crtl opened 2 years ago
I think you need to set your PATH up in the git bash.
export PATH=<path-to-pub-cache>/bin:$PATH
The <path-to-pub-cache>
will usually be
(If you are not using flutter but pure dart, it will be %LOCALAPPDATA%/Pub/Cache
)
You can run it as a single command for every bash session or stick it in your bash config file (https://stackoverflow.com/questions/6883760/git-for-windows-bashrc-or-equivalent-configuration-files-for-git-bash-shell).
Reopen if this doesn't solve the problem
Git bash uses windows system PATH so it is not required to manually reset it every time it is started.
@sigurdm I am not able to reopen the issue.
Can you type:
> $echo $PATH
in git bash?
Yes and it prints my path as I configured it in windows system variables UI. Also in general when I have to manually install a CLI app I install it, then use the windows systemvariables UI to add the bin to path and then it is available in git bash.
$ echo $PATH /c/Users/User/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/User/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/e/dev/xampp/php_74:/c/ProgramData/ComposerSetup/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/ProgramData/chocolatey/bin:/c/Program Files (x86)/Yarn/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Symfony:/c/HashiCorp/Vagrant/bin:/cmd:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/nodejs:/c/Users/User/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Users/User/AppData/Local/Programs/Python/Python38-32:/c/Program Files/JetBrains/PhpStorm 2019.3.3/bin:/c/cygwin64/bin:/c/Program Files/nodejs:/c/Users/User/AppData/Roaming/Composer/vendor/bin:/c/Program Files (x86)/cwRsync/bin:/d/dev/jdk-17.0.1/bin:/c/Users/User/AppData/Local/Programs/Microsoft VS Code/bin:/d/dev/xampp/php_74:/d/dev/xampp/mysql/bin:/c/Program Files/JetBrains/PyCharm Community Edition 2020.2.1/bin:/c/Users/User/AppData/Local/Yarn/bin:/c/Users/User/AppData/Local/Microsoft/WindowsApps:/d/dev/jetbrains-toolbox-scripts:/c/Program Files/PostgreSQL/13/bin:/e/dev/xampp/php_8:/d/dev/bin:/c/Users/User/AppData/Local/Pub/Cache/bin:/d/dev/flutter/sdk/bin/cache/dart-sdk/bin:/d/dev/flutter/sdk/bin:/c/Users/User/AppData/Local/Android/Sdk/platform-tools:/c/Users/User/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl
Can you run: /c/Users/User/AppData/Local/Pub/Cache/bin/fvm.bat
from inside git bash ?
Yes:
$ /c/Users/User/AppData/Local/Pub/Cache/bin/fvm.bat
Flutter Version Management: A cli to manage Flutter SDK versions.
Usage: fvm <command> [arguments]
Global options:
-h, --help Print this usage information.
--verbose Print verbose output.
--version current version
Available commands:
config Set configuration for FVM
dart Proxies Dart Commands
doctor Shows information about environment, and project configuration.
flavor Switches between different project flavors
flutter Proxies Flutter Commands
global Sets Flutter SDK Version as a global
install Installs Flutter SDK Version
list Lists installed Flutter SDK Versions
releases View all Flutter SDK releases available for install.
remove Removes Flutter SDK Version
spawn Spawns a command on a Flutter version
use Sets Flutter SDK Version you would like to use in a project
Run "fvm help <command>" for more information about a command.
Hmmm, ok - what about running
$ fvm.bat
Does that work?
Yes that works.
Ok, I don't think we can do much more.
I guess that is the pain of working with bash on windows.
Couldn't the .sh also be installed ?
Couldn't the .sh also be installed ?
I guess that would work. I don't have much experience with WSL.
Can a file be marked executable on WSL? Should we always create the bash-script on windows or only if we detect that we are running under WSL?
@sigurdm As far as I know WSL(2) is just a normal installation of a Linux Distro (Ubuntu in my case) with all its features the same it would run in a VM or on normal system. The Windows drives are mounted in /mnt and from Windows its accessed over \wsl$ Network drive. You also have the same permission system with users and groups and windows user has userid 1000.
user@DESKTOP-ID ~ $ ls -la
total 152
drwxr-xr-x 15 user user 4096 Aug 4 14:55 .
drwxr-xr-x 3 root root 4096 Aug 17 2021 ..
lrwxrwxrwx 1 user user 24 Aug 17 2021 .aws -> /mnt/c/Users/user/.aws
lrwxrwxrwx 1 user user 26 Aug 17 2021 .azure -> /mnt/c/Users/user/.azure
-rw------- 1 user user 43331 Aug 4 14:55 .bash_history
-rw-r--r-- 1 user user 220 Aug 17 2021 .bash_logout
-rw-r--r-- 1 user user 4111 Jul 29 10:52 .bashrc
drwxr-xr-x 6 user user 4096 Aug 1 18:22 .cache
drwxr-xr-x 5 user user 4096 Sep 8 2021 .config
drwxr-xr-x 5 user user 4096 Jul 29 14:25 .docker
-rw-r--r-- 1 user user 193 Aug 31 2021 .gitconfig
drwx------ 3 user user 4096 Jul 29 17:47 .gnupg
drwx------ 2 user user 4096 Aug 4 17:51 .keychain
drwxr-xr-x 2 user user 4096 Aug 17 2021 .landscape
drwxr-xr-x 3 user user 4096 Aug 17 2021 .local
-rw-r--r-- 1 user user 0 Aug 4 10:16 .motd_shown
drwxr-xr-x 7 user user 4096 Sep 28 2021 .npm
-rw-r--r-- 1 user user 807 Aug 17 2021 .profile
drwxr-xr-x 3 user user 4096 Jul 29 10:45 .ssh
-rw-r--r-- 1 user user 0 Aug 17 2021 .sudo_as_admin_successful
-rw------- 1 user user 14506 Aug 1 09:50 .viminfo
drwxr-xr-x 5 user user 4096 Oct 18 2021 .vscode-server
-rw-r--r-- 1 user user 183 Oct 18 2021 .wget-hsts
drwxr-xr-x 4 user user 4096 Jul 29 17:47 .yarn
-rw-r--r-- 1 user user 116 Aug 4 13:04 .yarnrc
drwxr-xr-x 2 user user 4096 Nov 19 2021 node_modules
drwxr-xr-x 7 user user 4096 Aug 4 11:30 projects
-rw-r--r-- 1 user user 86 Nov 19 2021 yarn.lock
in my case it is via git bash and not WSL
Does anyone have an idea about this on git bash yet?
We still need to answer the question:
Should we always create the bash-script on windows or only if we detect that we are running under WSL2?
And also how do we detect we are running under wsl2?
Should we always create the bash-script on windows or only if we detect that we are running under WSL2?
Always, it's not only about WSL. Is there any drawback on always doing it ? That behavior is not uncommon
Can we always make it executable - also outside a WSL2 environment? And how (currently we shell out to chmod
on linux/mac)
outside a WSL2 environment?
Git bash (I don't think it uses WSL under the hood)
I don't think we can assume git bash is installed on any system
@sigurdm you asked :
Should we always create the bash-script on windows or only if we detect that we are running under WSL2?
It's not only for WSL2, git bash would use it, so definitely not only when WSL2 is used. Is it just a matter of adding that file ? If someone does not have git bash nor WSL2 there is no side effect, is there ? So I don't see why you'd have to assume anything. I'm probably misunderstanding something here.
there is no side effect, is there ? So I don't see why not
That was basically also my question. I'm not very familiar with neither windows nor WSL, so i want to be careful in assumptions about how they work.
But even if we create the shell script along the .bat
file - we still need to mark it executable for WSL2 to execute it - no? Or is everything considered executable?
Maybe this https://github.com/microsoft/WSL/issues/2003#issuecomment-297173637 can be used as a work-around?
@sigurdm
thanks, it worked for me to use the fvm.bat
When using
dart pub global activate
to install packages on windows systems, the installed packages / commands are only available in windows CMD or PowerShell but not in Git Bash.Packages installed via pub global should also be runnable in git bash for windows.
Reproduction:
dart pub global activate fvm
fvm flutter --version
in powershell/cmd/windows terminal worksIve also tested it with global installed
devtools
package wich has the same effect. Ive also installedmake
on my system and when runningmake
in git bash it does not produce any errors.Makefile:
Environment: