I'm trying to play with https://github.com/dart-lang/web-ui-code-lab for dart development. If I follow the pdf and open step05, then try to run chat_server.dart, I get this error (my path has no spaces in it, in case that's relevant):
dart --enable-checked-mode bin/chat_server.dart
Unable to open file: path/to/web-ui-code-lab-master/step05/bin/packages/dart_chat/file_logger.dart'file:///path/to/dart/web-ui-code-lab-master/step05/bin/chat_server.dart': Error: line 5 pos 1: library handler failed
import 'package:dart_chat/file_logger.dart' as log;
^
I presume this means that there are some missing dependencies, but I can't run pub install because I'm behind a corporate http proxy:
Running pub install ...
Pub install failed, [1] Resolving dependencies...
Timed out trying to find package "web_ui 0.2.8+6" at http://pub.dartlang.org.
Hence, I started looking for a temporary workaround for pub dependency resolution. I tried changing the pubspec.yaml to go through the git:// protocol instead of http (which won't resolve without going through the proxy):
name: dart_chat
description: This is a chat app written in Dart using the Dart Web UI package
dependencies:
web_ui:
git: git://github.com/dart-lang/web-ui.git
I get further than before with pub install, so I think it successfully went through the git protocol and is trying to resolve web_ui's dependencies, but unfortunately doing so fails on web_ui's dependency for logging (which looks like it's still going through http://):
Running pub install ...
Pub install failed, [1] Resolving dependencies...
Timed out trying to find package "logging 0.2.7" at http://pub.dartlang.org.
It looks like I can't change the yaml to use the sdk's logging dependency either:
logging:
sdk: logging
because that's an incompatible source with web_ui:
Pub install failed, [1] Resolving dependencies...
Incompatible dependencies on 'logging':
- 'dart_chat' depends on it from source 'sdk'
- 'web_ui' depends on it from source 'hosted'
Is there any other way to get around this proxy issue with the current dev tools? Could I mirror pub.dartlang.org somehow? Or mirror the git repositories for each dependency? Thanks.
You said that you're using a Mac. If it's a laptop, why don't you try doing it from home? I'll notify the author of pub about this issue to see if he has any suggestions.
Currently there is no way to set a proxy in the Dart Editor, you can star this issue to check when it will be available.
I found a workaround to run the Pub install/update behind a proxy: in Windows, you can acess the "Environment variables" and add a variable named HTTP_PROXY with the value
https://USER:PASSWORD#my.proxy.adress:PORT
Related
I'm trying to get started and setup to develop Dart.
I'm following the instructions on https://webdev.dartlang.org/guides/get-started to install on Linux. However there seems to be an essential step missing.
On the above link, step 2 is about installing the SDK.
Step 3 is titled:
Get CLI tools or WebStorm (or both)
However step gives examples of using the pub command, and the links it references also use this command, however there are no instructions on where to find the pub utility or how to install it.
I would have assumed that pub was provided as part of the Dart SDK. I can run dart in my terminal, and see that it is installed. For example dart --version returns Dart VM version: 2.0.0 (Unknown timestamp) on "linux_x64". But pub returns zsh: command not found: pub
My question, therefore, is where do I find, and how do I install pub?
You need to add thedart-sdk/bin directory to the system PATH variable.
I've noticed on a few occasions that when I setup some dependencies in my pubspec.yaml pointing to the latest version, they aren't found when I run pub get.
For instance, the dependency source_gen. The latest version of source_gen is clearly 0.5.0+1. So I'll setup my pubspec.yaml file as follows:
dependencies:
source_gen: "^0.5.0+1"
Then I run pub get, and I get the following error:
Resolving dependencies...
Package source_gen has no versions that match >=0.5.0+1 <0.6.0 derived from:
- ServerErrors depends on version ^0.5.0+1
I tried several of the most recent versions, without much luck. Finally if I do the following:
dependencies:
source_gen: any
and then run pub get, source_gen version 0.4.7 is installed. I'm not sure I understand why. I'm using the dart sdk version 1.16.0. This is the second dependency I've had this issue with and I'm a little confused.
EDIT: As requested by Gunter, the full list of my dependencies:
dependencies:
http: "^0.11.3+7"
dartson: "^0.2.5"
intl: "^0.12.7+1"
mailer: "^1.0.0"
That's a known issue of pub. This means pub just wasn't able to resolve a compatible set of dependencies. Unfortunately the error message is misleading.
pub also prints the same error when one of the dependencies isn't compatible with the used Dart SDK version.
I had moved my Dart Project to another folder, with the same folder structure, however, now, I'm receiving the following message:
Running pub install ...
Pub install failed, [1] Resolving dependencies...
Could not find package "dartflash 0.6.3" at http://pub.dartlang.org.
Here is my pubspec.yaml:
name: Chronium
description: A framework for doing Chrono like games.
dependencies:
dartflash: 0.6.3
And pubspec.lock:
{"packages":{"dartflash":{"version":"0.6.3","source":"hosted","description":"dartflash"}}}
And the file structure:
The website (http://pub.dartlang.org/) is accessible from the browser.
I'm on dart (Dart Editor version 0.2.9_r16323). Do someone knows what is happening?
According to Seth Ladd post, this should be fixed now :
If you were having troubles with pub.dartlang.org, we're happy to report that we've fixed the issue. Many apologies for the temporary downtime. Looks like it was an issue with the server pointing to the wrong data store. Thanks for all the reports, the pub is open again!
I'm running pub install so I can use the intl package (I need to use the DateFormat class) that's part of the dart sdk. I've installed other packages into my project such as the XML parser and presentation (similar to impress js). I had no trouble running pub install in the past when I installed the packages that are currently included in my project, but today it just sits in the "running pub install" dialog. I took the intl package declaration out of the yaml file and attempted to update, but it would still hang. I don't get an error message or any indication that the request to install the package is actually being processed.
So, I'm asking whether or not there is a known issue with the pub install feature? What can I do in the meantime?
Here's my yaml code:
name: test_client
description: A sample application
dependencies:
xml:
git: https://github.com/prujohn/dart-xml.git
presentation:
git: https://github.com/CatalystItLabs/presentation.dart
intl:
sdk: intl
Please note that the xml and presentation packages are installed. I reached out to the dartlang community via twitter, but I haven't yet received a response.
Try using git read-only version
dependencies:
xml:
git: git://github.com/prujohn/dart-xml.git
i try https before doesn't work but this work
I've filed a bug http://code.google.com/p/dart/issues/detail?id=6843 about analogous problem.
Feel free to star it to stay tuned for news about possible fixes.
I am trying to install glmatrix using pub install. My OS is Windows 7 and I have Git installed.
Here is my pubspec.yaml
name: WebGLTut1
description: A sample application
dependencies:
glmatrix:
git: git://github.com/pjako/glmatrix.dart.git
When I run pub install I get the following error:
Running pub install ... Pub install fail, FormatException: Could not
parse "git://github.com/pjako/glmatrix.dart.git".".
I googled a while to find a solution but couldn't. Please help.
UPDATE#1:
I found the problem. There has to be a TAB/Space when specifying git: url in pubsec.yaml as follows.
glmatrix:
git: git://github.com/pjako/glmatrix.dart.git
This solved the previouse problem of FormatException. But now when I run pub install again it throws theis error.
Running pub install ... Pub install fail, Git failed.
As you identified you update, yaml files are whitespace sensitive; that's why you don't have to use lots of curly braces like json. :)
I see a few of possible problems here:
First
Glmatrix doesn't appear to have its own pubspec defined. Libraries participating in the package system much declare a pubspec file with the name property defined. The name is important because pub uses it when you declare your dependencies. Let's say you had a project called toast with the following simple pubspec:
name: butter
version: 0.0.0
Then you would need to declare your dependency to that project like so:
dependencies:
butter:
git: git://github.com/foo/toast.git
Have the project owner make the changes or fork it yourself, add the pubspec, and then reference your fork in your pubspec.
Second
Glmatrix is does not conform to the pubspec package layout conventions (your own projects should also conform to this). Although I believe that pub may handle non-conforming layouts currently, it may not in the future. So again, you can either ask the project owner to fix, or fork and fix it yourself.
Third
Since you are on windows, make sure git is in your system PATH variable. If you are using the bash shell, git will work, but it's not going to work outside of bash (like from Dart editor) until you add it to your PATH.