0

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!

Community
  • 1
  • 1
OCDev
  • 2,280
  • 3
  • 26
  • 37
  • Does the log output contain any other errors/warnings? – Günter Zöchbauer Jul 13 '14 at 18:01
  • (Thank you much for helping me again with this.) If you're talking about Tools Output, I just get this: --- 1:03:17 PM Starting pub serve : sunflower --- – OCDev Jul 13 '14 at 18:04
  • Where did you get the source for the Sunflower demo? – Günter Zöchbauer Jul 13 '14 at 18:07
  • The source for the Sunflower demo I presume comes along with the Dart Editor inside of the zip that I extracted to install it. I got it from the first download link on the front page of www.dartlang.org. It says DOWNLOAD DART + EDITOR (64-BIT Linux) I extracted the Dart Editor zip into /opt/. Opening the Dart Editor I am taken to the Welcome page and clicking on the Sunflower demo on the welcome page seems to copy the Sunflower project into /home/{user}/dart/sunflower from somewhere (probably from within the package that I unzipped--unless it gets downloaded from somewhere). – OCDev Jul 13 '14 at 18:17
  • 3
    Can you please try to open `http:// localhost:8080/sunflower.html` after starting `pub serve` on the command line. `pub serve` doesn't redirect to `index.html` or similar when not entry page is part of the URL. – Günter Zöchbauer Jul 13 '14 at 18:34
  • Opening to http:// localhost:8080/sunflower.html worked! And it is enough to get me started. But it will be really good to get this working when running from inside of the Dart Editor. – OCDev Jul 13 '14 at 18:39
  • Great! One step forward. I have Dart extracted below my home directory. You could at least try if it makes a difference. – Günter Zöchbauer Jul 13 '14 at 18:42
  • Ok, I decided to chmod 777 the paths and files in my /opt/dart/dart-sdk/bin folder and I am now getting error messages in my Tools Output. This is good! Permission denied errors. When I try to run again, I find more files that I need to chmod 777 on in order to find more of them. Over and over. Dart Editor seems to create files in places with restricted permissions that I have to go and fix. Is there a better way to install Dart Editor so that the file permissions get created properly for everything? (Yes I know 777 is too permissive, but I'm just trying to solve the problem right now.) – OCDev Jul 13 '14 at 18:52
  • Ok, I think I've reached the bottom of the permission issues. Now when I run I get no Tools Output messages, but I get a popup that says, "Could not launch browser - process terminated on startup: Dartium stdout: /opt/dart/chromium/chrome: error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory" – OCDev Jul 13 '14 at 18:56
  • 1
    This seems to be a quite different error see https://code.google.com/p/dart/issues/detail?id=12325 I propably won't be available anymore today. – Günter Zöchbauer Jul 13 '14 at 18:59
  • That link you sent me was the final missing piece. Applying this worked: sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0 – OCDev Jul 14 '14 at 11:46
  • With a whole lot of blind configuration adjustments needed, Dart Editor does finally work. And it's great! Someday it will be a more mature and very successful product. Thank you so much for your help! – OCDev Jul 14 '14 at 11:49
  • 1
    There should already be a Debian installer package available but I didn't try it yet. Beside the libudev.so.1 problem (which is not a Dart but a Linux problem) I didn't have a problem so far (as I mentioned: I placed Dart in my home directory) – Günter Zöchbauer Jul 14 '14 at 11:50
  • I just wanted to include a future note to myself: The -R switch on chmod is very useful for recursively setting folder permissions, so doing sudo chmod -R 777 on the /opt/dart directory where I installed dart will save a lot of work setting permissions for everything that needs it for Dart Editor. (Again, 777 is probably too permissive and should be given more thought.) – OCDev Jul 14 '14 at 11:55
  • Another future note to self: I re-installed for version 1.6.0 and in order to get it to run inside of Dart Editor, I had to first run "sudo /opt/dart/dart-sdk/bin/pub serve" inside of the sunflower folder where pubspec.yaml is located. If I do not do that, I keep getting the dreaded "Could not start pub serve or connect to pub." (with no hint as to why) Everything continues to work fine inside of Dart Editor after doing that. – OCDev Sep 18 '14 at 23:26

2 Answers2

1

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).

Entitled
  • 41
  • 6
-1

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