我正试图修复一个在最新的dart版本上不起作用的库。
现在我面临的问题来自测试设置中的以下行:
Process.runSync('pub', ['get'], workingDirectory: stubPath);
错误为:
ProcessException: The system cannot find the file specified.
Command: pub get
dart:io Process.runSync
testtest_coverage_test.dart 32:15 main.<fn>.<fn>
pub
可执行文件在我的路径上,从shell手动运行时运行良好。我检查了一下,dart进程确实正确地接收了环境(设置了PATH(。
我在windows 10上工作,并尝试在powershell
和cmd
中运行测试,甚至在administrator中运行测试。
在从Dart 2.9.x升级到2.12.1 之前,该库运行良好
我遇到了同样的问题,我修复了传递runInShell: true
参数的问题:
await Process.runSync('pub', ['get'], workingDirectory: yourWorkingDir, runInShell: true);