flutter sdk在Mac上安装后的一些报错...

Flutter Bad CPU type in executable

在mac上flutter环境配置完成后,报错:

Flutter Bad CPU type in executable

可能有两个原因

  1. M1芯片不支持Interl芯片架构的程序,需要rosetta这个适配器进行适配才可以,需要执行softwareupdate --install-rosetta之后安装rosetta。如果执行后报not support的错误,那可能是下面的原因。
  2. SDK下错了,比如mac不是m1,但下载了不正确的cpu架构的SDK,或者beta版本的sdk,就会报错,这里需要重新下载,先执行 uname -a 查看自己电脑cpu架构是x64还是arm,再下载对应的稳定版本。
    1656553070428.png

    类似问题:https://github.com/flutter/flutter/issues/106054

Creation of temporary directory failed

flutter doctor执行报错:

[flutter_xxx] flutter packages get Running "flutter packages get" in flutter_xxx...
Creation of temporary directory failed, path = 'C:\Program Files\flutter.pub-cache_temp\dir' (OS Error: Access is denied. , errno = 5)

解决方案1:(mac)

mkdir tmp
export TMPDIR=~/tmp

解决方案2:

flutter pub cache repair

类似问题:https://stackoverflow.com/questions/54233412/flutter-pub-get-failed-66

你可能感兴趣的:(flutter sdk在Mac上安装后的一些报错...)