我正在使用Macbook。 在运行Flutter Channel Master和Flutter升级后,出现以下错误。
请问对此有什么解决方案吗?
Unhandled exception:
Invalid argument(s): Cannot find executable for sysctl.
#0 _getExecutable (package:process/src/interface/local_process_manager.dart:124:5)
#1 LocalProcessManager.runSync
(package:process/src/interface/local_process_manager.dart:91:30)
#2 ErrorHandlingProcessManager.runSync.<anonymous closure>
(package:flutter_tools/src/base/error_handling_io.dart:649:37)
#3 _runSync (package:flutter_tools/src/base/error_handling_io.dart:548:14)
#4 ErrorHandlingProcessManager.runSync
(package:flutter_tools/src/base/error_handling_io.dart:649:12)
#5 _DefaultProcessUtils.runSync (package:flutter_tools/src/base/process.dart:421:51)
#6 _MacOSUtils.hostPlatform (package:flutter_tools/src/base/os.dart:305:25)
#7 _MacOSUtils.name (package:flutter_tools/src/base/os.dart:291:123)
#8 new _DefaultUsage (package:flutter_tools/src/reporting/usage.dart:247:18)
#9 new Usage (package:flutter_tools/src/reporting/usage.dart:81:9)
#10 runInContext.<anonymous closure>
(package:flutter_tools/src/context_runner.dart:247:20)
#11 AppContext._generateIfNecessary.<anonymous closure>
(package:flutter_tools/src/base/context.dart:104:41)
#12 _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:291:23)
#13 AppContext._generateIfNecessary (package:flutter_tools/src/base/context.dart:92:20)
#14 AppContext.get (package:flutter_tools/src/base/context.dart:121:32)
#15 flutterUsage (package:flutter_tools/src/globals.dart:55:35)
答案 0 :(得分:2)
解决方法是首先尝试在您的系统中找到sysctl 的安装。在某些 MacO 中,它位于 /usr/sbin。那么,如何发现呢?在终端中执行以下命令:whereis sysctl
或 which sysctl
。结果将类似于:/usr/sbin/sysctl
。
之后,将其添加到 PATH。
# Adding /usr/sbin/ to path
PATH=/usr/sbin/:${PATH}
export PATH
将其复制并粘贴到 ~/.bash_profile 或 ~/.zshrc 文件中。
重新启动您的终端(关闭它并再次打开)并运行 flutter doctor
。大功告成!