반응형

에러 전문
빠른 해결 : #vi ~/.pub-cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart

 

환경

# flutter --version
Flutter 2.13.0-0.4.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 25caf1461b (3 weeks ago) • 2022-05-05 14:23:09 -0700
Engine • revision c5caf749fe
Tools • Dart 2.17.0 (build 2.17.0-266.8.beta) • DevTools 2.12.2

 

# dart --version

Dart SDK version: 2.17.0-266.8.beta (beta) (Tue May 3 16:22:31 2022 +0200) on "macos_x64"

 

flutter doctor 문제 없음 확인

 

그러나,

 

 

# flutter packages pub global activate webdev

... 생략

... 생략

+ web_socket_channel 2.2.0
+ webdev 2.7.8 (2.7.9 available)
+ webkit_inspection_protocol 1.1.0
+ yaml 3.1.1
Building package executables...
Failed to build webdev:webdev:
../.pub-cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart:540:24: Error: The method 'ChromeProxyService.getSourceReport' has fewer named arguments than those of overridden method 'VmServiceInterface.getSourceReport'.
  Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
                       ^
../.pub-cache/hosted/pub.dartlang.org/vm_service-8.3.0/lib/src/vm_service.dart:846:24: Context: This is the overridden method ('getSourceReport').
  Future<SourceReport> getSourceReport(
                       ^
../.pub-cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart:540:24: Error: The method 'ChromeProxyService.getSourceReport' doesn't have the named parameter 'libraryFilters' of overridden method 'VmServiceInterface.getSourceReport'.
  Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
                       ^
../.pub-cache/hosted/pub.dartlang.org/vm_service-8.3.0/lib/src/vm_service.dart:846:24: Context: This is the overridden method ('getSourceReport').
  Future<SourceReport> getSourceReport(
                       ^
pub finished with exit code 1

 

위와같은 에러가 발생하면서 안되는 것 확인했고 검색하여

stackoverflow 답변을 통해 해결했습니다

 

 

해결 :

 

1. 문제 발생한 dart 소스 파일을 vi로 엽니다.

(저의 경우 ~/.pub-cache/hosted/pub.dartlang.org/dwds-12.1.1/lib/src/services/chrome_proxy_service.dart)

 

2. 에러 발생한 라인 (540라인) 이동

(vi로 열었을 시 명령어는 :540입력 후 엔터

 

3. (1번 컬럼은 line number)

 540   Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
 541       {String scriptId,
 542       int tokenPos,
 543       int endTokenPos,
 544       bool forceCompile,
 545       bool reportLines}) async {

 

이렇게 돼있을텐데

 

 540   Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
 541       {String scriptId,
 542       int tokenPos,
 543       int endTokenPos,
 544       bool forceCompile,
 545       bool reportLines,
 546       List<String> libraryFilters}) async {

 

이렇게 수정한다 (굵게 처리된 부분을 추가)

 

그리고 다시

# flutter packages pub global activate webdev

...생략

+ web_socket_channel 2.2.0
+ webdev 2.7.8 (2.7.9 available)
+ webkit_inspection_protocol 1.1.0
+ yaml 3.1.1
Building package executables...
Built webdev:webdev.
Installed executable webdev.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated webdev 2.7.8.

 

성공했다

 

 

원인 : 대충 ChromeProxyService 소스가 dwds-12.1.1 dart 소스 dwds-12.1.1패키지에 맞지 않게 되어있었음

 

 

참고 : https://stackoverflow.com/questions/72200137/dart-pub-global-run-webdev-serve-building-package-executable-failed-to-build

 

dart pub global run webdev serve Building package executable... Failed to build webdev:webdev:

C:\flutter\bin (stable) λ dart pub global run webdev serve Building package executable... Failed to build webdev:webdev: /C:/Users/valen/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dwds-12.1....

stackoverflow.com

 

 

 

반응형
복사했습니다!