flutter环境之安装FVM

1:  一定要安装 choco
用管理员身份运行 cmd | Powershell
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

否则不好全局管理FVM,全部输入Y

2: choco install fvm

3:  fvm config --cache-path D:\fvm\

4: 在用户环境变量中添加 FVM_HOME,设置为 D:\fvm\

5: fvm install 3.7.7

6: fvm global 3.7.7

7: 在path里添加  D:\fvm\default\bin  和  D:\fvm\default\bin\cache\dart-sdk\bin

8: path里删除安装choco时添加的 C:\tools\dart-sdk\bin

9: vscode里setting里搜索flutterSdkPaths   输入 D:/fvm/  就可以在vscode里change sdk了

10:完成 !

https://fvm.app/docs/guides/faq/#environment-variables-order-for-windows-in-path

-------------------------------------------------------------------------------------------------------------------

Invalid kernel binary or invalid sdk hash when running FVM

There are a few reasons this can happen. However it means that the FVM snapshot is not compatible with the Dart version that is installed.

Please do the following:

  1. On Windows make sure your env variables are in the following order as described here.
  2. Run dart pub global deactivate fvm
  3. Run dart pub global activate fvm

-------------------------------------------------------------------------------------------------------------------

Environment variables order for Windows in PATH

Flutter comes with Dart embedded. Because of that you can find some conflicts when running standalone Dart and Flutter together. Here is a suggestion of what we found to be the correct order of dependencies to avoid issues.

  1. Pub Cache for global packages
  2. Dart SDK (if installed outside of Flutter)
  3. Flutter SDK

It should look like this.

C:\Users\<user>\AppData\Roaming\Pub\Cache\bin
C:\src\flutter\bin\cache\dart-sdk\bin
C:\src\flutter\bin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值