analyzer plugins crash with `The system cannot find the file specified.` error
DetachHead opened this issue · 14 comments
dart-code-checker/dart-code-metrics#749 (comment)
that doesn't seem to work anymore since i updated flutter to the master channel, no longer seeing errors in intellij despite having the plugin enabled in
analysis_options.yaml:analyzer: plugins: - dart_code_metrics dart_code_metrics: rules: - no-empty-block>flutter --version Flutter 2.13.0-0.0.pre.242 • channel master • https://github.com/flutter/flutter.git Framework • revision 10142b5817 (11 hours ago) • 2022-03-24 18:47:19 -0700 Engine • revision 816c8651d8 Tools • Dart 2.17.0 (build 2.17.0-232.0.dev) • DevTools 2.11.4i see this when i open the analyzer diagnostics:
ProcessException: The system cannot find the file specified. Command: C:\Users\amogus\Documents\flutter\bin\cache\dart-sdk\bin\pub.bat upgrade #0 _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:487:7) #1 _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:632:18) #2 Process.runSync (dart:io-patch/process_patch.dart:68:12) #3 PluginManager._computeFiles (package:analysis_server/src/plugin/plugin_manager.dart:641:28) #4 PluginManager.filesFor (package:analysis_server/src/plugin/plugin_manager.dart:462:14) #5 PluginManager.addPluginToContextRoot (package:analysis_server/src/plugin/plugin_manager.dart:328:23) #6 PluginWatcher.addedDriver (package:analysis_server/src/plugin/plugin_watcher.dart:68:19) #7 AnalysisDriver.configure (package:analyzer/src/dart/analysis/driver.dart:555:33) #8 ContextBuilderImpl.createContext (package:analyzer/src/dart/analysis/context_builder.dart:137:12) #9 new AnalysisContextCollectionImpl (package:analyzer/src/dart/analysis/analysis_context_collection.dart:67:36) #10 ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:449:40) #11 ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package:analysis_server/src/context_manager.dart:444:41) #12 ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded (package:analysis_server/src/context_manager.dart:559:17) #13 ContextManagerImpl.setRoots (package:analysis_server/src/context_manager.dart:280:5) #14 AnalysisServer.setAnalysisRoots (package:analysis_server/src/analysis_server.dart:456:7) #15 AnalysisSetAnalysisRootsHandler.handle (package:analysis_server/src/handler/legacy/analysis_set_analysis_roots.dart:50:7)
I see we run pub directly in analysis_server, which might be removed in Dart 2.17? Actually, according to the changelog, it was removed in 2.16: https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md#tools-1
pkg/analysis_server/lib/src/plugin/plugin_manager.dart: var pubPath = path.join(path.dirname(vmPath), 'pub');
Marking as P1 unless we think this is not on the hot path for analyzer plugins.
Ah, I still have pub in my xcodebuild/ReleaseARM64/dart-sdk/bin, remaining there since the time it still existed. I guess its time to nuke the whole directory.
This seems to help.
https://dart-review.googlesource.com/c/sdk/+/240901
One more reference, but can be fixed separately:
pkg/analysis_server/lib/src/services/pub/pub_command.dart: Platform.isWindows ? 'pub.bat' : 'pub',
@srawlins @scheglov - I see the fix for this landed. See my comment on the dup of this issue - #48786 (comment); we'll probably want to file a cherry pick request for the fix.
Hey, any news about it being cherry-picked to earlier versions?
With Flutter 3.0 and Dart 2.17 being released to stable, it now blocks using the analyzer plugins.
+1 This makes all plugins crash, especially dart_code_metrics which provides many useful linter rules in addition to official rules
+1. dart_code_metrics is still crashing because of this
Hey @devoncarew,
is there an estimated date when this fix will be available in Dart >2.17.0 and Flutter >3.0.0?
Could the fix be cherry-picked in the latest Dart stable release?
Could the fix be cherry-picked in the latest Dart stable release?
Yes we'll file a cherry-pick request.
Execute flutter upgrade. With the new flutter version 3.0.1 it's working again.

