简体   繁体   中英

pub install dart-web-components failed

Running pub install on dart-web-components gives an error:

Pub install fail, HttpParserException: Connection closed before full header was received

/dart-web-components/build.dart --changed=packages\args\args.dart --changed=packages\args\src\utils.dart --changed=packages\logging\...
Failed with error code 255
Unable to open file: C:/dartapps/dart-web-components/packages/web_components/component_build.dart'file:///C:/dartapps/dart-web-components/build.dart': Error: line 8 pos 1: library handler failed

import 'package:web_components/component_build.dart'; ^

In build.dart file there's a string

import 'package:web_components/component_build.dart';

Editor shows an error

Cannot find referenced source: package:web_components/component_build.dart    

component_build.dart contains errors

Cannot find referenced source: package:args/args.dart
Cannot find referenced source: package:web_components/dwc.dart

I solved this problem. It seems that the Cache folder (Pub) has been corrupted.

I have deleted the folder Cache:

C:\\Users\\< UserName >\\AppData\\Roaming\\Pub

Then i run pub install from command line and it works.

My OS is Windows 7.

OK, so looking at your output:

Pub install fail, HttpParserException: Connection closed before full header was received

This is the real problem.

/dart-web-components/build.dart --changed=packages\args\args.dart --changed=packages\args\src\utils.dart --changed=packages\logging\...
Failed with error code 255
Unable to open file: C:/dartapps/dart-web-components/packages/web_components/component_build.dart'file:///C:/dartapps/dart-web-components/build.dart': Error: line 8 pos 1: library handler failed

These are just red herrings caused by the first problem.

I see you are on Windows. There is a known issue where the HTTP stuff has some intermittent non-deterministic failures. I'm still investigating, but it's hard to track down.

Do you get this error every time you try? How many attempts have you made?

Sorry for the trouble here.

I tried many times. I now put dart-web-components to the default package-root directory. Pub install now yields

Pub install fail, Package "html5lib" doesn't have a pubspec.yaml file.

However, the editor shows the same errors

Cannot find referenced source: package:web_components/component_build.dart
Cannot find referenced source: package:args/args.dart

etc. In almost every *.dart file

Added this in pubscpec.yams

html5lib: git: git://github.com/dart-lang/html5lib.git

Now I get again

Pub install fail, HttpParserException: Connection closed before full header was received

Do you using an proxy to access the internet? DartEditor cann't set the proxy,so it cann't access the pub packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM