我已经将这些添加到了我的.zshrc文件中
export PATH="$PATH:`pwd`/.pub-cache/bin"
export PATH="$PATH:`pwd`/fvm/default/bin"
export PATH="$PATH:`pwd`/bin/cache/dart-sdk/bin"当我在终端中工作时,Flutter和fvm似乎工作得很好。但是一旦我创建了一个新项目,并且我在Android Studio中使用了终端,我就找不到命令了。
➜ flutter_fvm_stable echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/{Username}/flutter_fvm_stable/.pub-cache/bin:/Users/{Username}/flutter_fvm_stable/fvm/default/bin:/Users/{Username}/flutter_fvm_stable/bin/cache/dart-sdk/bin
➜ flutter_fvm_stable fvm doctor
zsh: command not found: fvm我设法解决了flutter命令的这个问题:
➜ flutter_fvm_stable exexport PATH="/Users/{Username}/flutter/bin:$PATH"
➜ flutter_fvm_stable flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-BE)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
...但是,当我尝试使用fvm路径时,仍然什么也得不到。
➜ flutter_fvm_stable exexport PATH="/Users/{Username}/fvm/default/bin:$PATH"
➜ flutter_fvm_stable fvm doctor
zsh: command not found: fvm我试过跑步
export PATH="$PATH":"$HOME/.pub-cache/bin"但后来我得到了
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):
export PATH="$PATH":"$HOME/.pub-cache/bin"虽然我的.zshrc文件中已经有这一行
export PATH="$PATH:`pwd`/.pub-cache/bin"非常感谢你试着帮我!
发布于 2021-06-05 03:47:13
这个问题已经解决了,因为我在Android Studio之外的终端中使用了以下代码:
brew tap leoafarias/fvm
brew install fvmhttps://stackoverflow.com/questions/67841769
复制相似问题