OCDev
OCDev

Reputation: 2369

Dart Editor Dartium: "could not start pub serve or connect to pub"

I just installed Dart Editor on Ubuntu 14.04, opened the Sunflower demo, right clicked on sunflower.html, chose Run in Dartium, and was faced with "Could not start pub serve or connect to pub." So I went to Google and found the following reasons why this happens:

"Run in Dartium" doesn't invoke "pub serve" correctly for Dart files that aren't in web/ or test/ (But the Sunflower demo files are all in web/)
https://code.google.com/p/dart/issues/detail?id=18990

Project files must be inside "C:\Users[username]\dart" instead of "C:\progs\Dart\projects" (Doesn't help; I'm not on Windows, but would demos that come with Dart Editor be in the wrong place?)
https://code.google.com/p/dart/issues/detail?id=19659

Same problem in recent release shows up on Mac OSX, bug fix promised in that next release (Doesn't help; I'm not on Mac OSX and that next release already came)
https://code.google.com/p/dart/issues/detail?id=19143

Another service is listening on port 8080 (Nope, I checked the ports and also made sure nothing with dart pub serve was already running, plus rebooted a couple of times)
dart error - could not start pub serve or connect to pub

So I found more information that gave me the idea to try pub serve from the command line. So I went to the directory where the sunflower project was placed by the Dart Editor (where the pubspec.yaml is found) and in the command line I typed:

sudo /opt/dart/dart-sdk/bin/pub serve

Which resulted in:

You don't have a lockfile, so we need to generate that:
Resolving dependencies... (1.1s)
Downloading browser 0.9.1...
Got dependencies!
Loading source assets... 
Serving sunflower web on http:// localhost:8080
Build completed successfully

Great, I thought, so I opened Chrome and visited http:// localhost:8080 and saw this:

404 Not Found
Could not find asset web in package sunflower.

And in my command line console I saw this:

[web] GET / → Could not find asset sunflower|web.
[web] GET /favicon.ico → Could not find asset sunflower|web/favicon.ico.

I am about to get more aggressive with my Google search and investigation, but I thought I would have this question out here just in case I cannot find the answer. Even though I encounter many obstacles before running my first Dart demo, which makes for a poor introduction (I know, Dart is new), I keep liking what people say about it and I am compelled to get this working. Please help me like Dart. :)

Much appreciated!

Upvotes: 0

Views: 1882

Answers (2)

hayukleung
hayukleung

Reputation: 1

You may try like this, [run]-->[Manage Launches], then unmarked "Use pub serve to serve the application", good luck!

Upvotes: -1

Entitled
Entitled

Reputation: 41

I came across similar error and this solved it for me:
1) Move all html/css/dart files to /web directory.
2) Than create a pubspec.yaml with your projects dependences (usually it's "browser" only).

Upvotes: 1

Related Questions