2

After the update to the version 0.3.1_r17328 of Dart SDK and Dart Editor I have some trouble to import some library particulary Args library. I have the same problem both directly importing Args or importing Web_ui where Args is one of the dependencies.

Here is my pubspec.yaml:

name:  notes
description:  A sample application

dependencies:
  web_ui: 0.3.0+1

or:

name:  notes
description:  A sample application

dependencies:
  args: 0.3.1+1

Here is the error generate from build.dart

Unable to open file:     C:/Users/Fabio/Dropbox/progetti/note/packages/args/args.dart'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'package:args/args.dart';

'file:///C:/Users/Fabio/Dropbox/progetti/note/build.dart': Error: line 1 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
Fabio Benedetti
  • 317
  • 2
  • 12

5 Answers5

6

I solved the 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.

Fabio Benedetti
  • 317
  • 2
  • 12
1

Unfortunately, I was getting the same error with my windows XP machine.

In the end, I logged into my windows 7 machine and was able to download the packages, zipped them up and pasted the libraries into my windows XP dart editor. Success!

I had no reason to believe I had the exact proxy issue @shindokaku had as I am using my home computer.

I tried all the suggestions on deleting the .cache files, pub.lock files and the packages folder and retrying. I uninstalled dart editor and tried again. I also tried using the git resources to download web-ui and running commands through the command line to no avail

Including suggestions in this similar questions:

Community
  • 1
  • 1
kirkkohler
  • 41
  • 3
  • After updating to Dart Editor/SDK version 0.3.7_r18717 I now get the following error that WinXP isn't supported. "Pub install failed, [64] Sorry, but pub is not supported on Windows XP." At least there is a nicer error message and I know I should finally buy a newer computer. :) – kirkkohler Feb 23 '13 at 03:48
1

This problem has been haunting me over and over for a few weeks. I am not using Windows, so this answer is not intended to help the original poster who is using Windows 7.

If you are using Linux here are the steps I use to repair corrupted pub cache.

Go to the top level directory of your app. You should see at least pubspec.lock, pubspec.yaml, a folder named packages, and a folder named web. Delete your pubspec.lock, and packages folder.

[Make sure you aren't storing your own libraries in the packages folder]

cd ~/dart/myApp/
rm -r packages
rm pubspec.lock

Now once you have removed these files:

pub cache repair

Note 1: if your dart-sdk is not in your systems $PATH, than you will want to use the absolute path to the sdk when using the above command. Comment if you need that explained.

Note 2: This is working solution with Dart 1.5.3. I have not tested this on earlier versions.

jabgibson
  • 416
  • 4
  • 14
0

Try deleting your pubspec.lock file and packages directory in the root folder of the project. Then run pub install again, when things get wacky thats what I do.

adam-singer
  • 4,489
  • 4
  • 21
  • 25
0

You should try to run pub update. I have sometimes found that this doesn't work as expected from the editor, but generally works quite smoothly when called from the command line.

Shailen Tuli
  • 13,815
  • 5
  • 40
  • 51