系統(tǒng)環(huán)境:MacOS 13,M1芯片
1. 安裝HomeBrew:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed
2. 使用brew安裝Fvm:
brew tap leoafarias/fvm
brew install fvm
3.配置FVM_HOME:
export FVM_HOME="$HOME/fvm"
4. 安裝flutter SDK
查看遠(yuǎn)程flutter 發(fā)布的SDK
fvm releases
報(bào)錯(cuò)信息:
Failed to retrieve the Flutter SDK from: https://flutter-io.cn/flutter_infra_release/releases/releases_macos.json
Fvm will use the value set on env FLUTTER_STORAGE_BASE_URL to check versions
if you are located in China, please see this page: https://flutter.dev/community/china
Please run command with ?--verbose if you want more information
執(zhí)行:查看下報(bào)錯(cuò)詳情
fvm releases ?--verbose?
報(bào)錯(cuò)詳情:
[ ? ? 0.001s] SocketException: Connection refused (OS Error: Connection refused, errno = 61), address = raw.githubusercontent.com, port = 56560
[ ? ? 0.117s] HttpException: Not Found
Failed to retrieve the Flutter SDK from: https://flutter-io.cn/flutter_infra_release/releases/releases_macos.json
Fvm will use the value set on env FLUTTER_STORAGE_BASE_URL to check versions
if you are located in China, please see this page: https://flutter.dev/community/china
因?yàn)槭褂脟?guó)內(nèi)地址需要執(zhí)行以下命令:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
5.安裝SDK指定版本:
fvm install 3.7.5
查看已安裝的版本信息
fvm list
6.使用fvm配置全局SDK版本
fvm global 3.7.5
export PATH="$HOME/fvm/default/bin:$PATH"
最后讓環(huán)境變量生效
source ~/.zshrc
7.在VScode中使用Fvm
執(zhí)行doctor命令
fvm flutter doctor
版本切換:
//切換到1.22.6
fvm use 1.22.6 --force
//切換到 3.7.5
fvm use 3.7.5 --force
8.Fvm常用命令文章來源:http://www.zghlxwxcb.cn/news/detail-470697.html
- config: 對(duì) fvm 進(jìn)行配置
- flutter: 對(duì) Flutter 的命令進(jìn)行代理
- install: 安裝 Flutter 版本
- list: 查看已安裝的 Flutter 版本
- releases: 查看 Flutter sdk 都有哪些發(fā)布的版本
- remove:刪除已安裝的某個(gè) Flutter 的版本
- use: 選擇你要使用的版本
- version: 查看安裝 fvm 的版本
更具資料來源修改文章來源地址http://www.zghlxwxcb.cn/news/detail-470697.html
到了這里,關(guān)于MacOS 配置 Fvm環(huán)境的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!