shashi
shashi

Reputation: 1

pub install does not work in Dart

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.

Upvotes: 0

Views: 1150

Answers (1)

John Evans
John Evans

Reputation: 7393

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.

Upvotes: 2

Related Questions