Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub error message when version is not correct format is misleading #21229

Closed
DanTup opened this issue Oct 3, 2014 · 4 comments
Closed

Pub error message when version is not correct format is misleading #21229

DanTup opened this issue Oct 3, 2014 · 4 comments

Comments

@DanTup
Copy link
Collaborator

DanTup commented Oct 3, 2014

If I create a pubspec.yaml containing the following:

name: my_test
version: 1.0.0

Then "pub get" works fine. However, if I change it to:

name: my_test
version: 1.0

Then "pub get" gives the following error:

Error in pubspec for package "my_test" loaded from pubspec.yaml:
"version" field must be a string, but was "1.0".

The error message ("must be a string") doesn't seem to match with the problem. It would be better if the error indicated the expected format for a version (this confuses me every single time!).

@srawlins
Copy link
Member

srawlins commented Oct 4, 2014

cc @munificent.
Set owner to @srawlins.
Added Area-Pub, Started labels.

@srawlins
Copy link
Member

srawlins commented Oct 7, 2014

Fixed with https://codereview.chromium.org/632483002/

Now pub will suggest a fix:

Example:
$ cat pubspec.yaml
name: Name
description: A sample command-line application
version: 1.0

$ pub get
Resolving dependencies...
Error on line 3, column 10 of pubspec.yaml: "version" field must have three numeric components: major, minor, and patch. Instead of "1.0", consider "1.0.0".
version: 1.0
         ^^^


Added Fixed label.

@DartBot
Copy link

DartBot commented Oct 7, 2014

This comment was originally written by @mezoni


Error on line 3, column 10 of pubspec.yaml: "version" field must have three numeric components: major, minor, and patch. ...

In this case the following message would be shorter and more informative.

Error on line 3, column 10 of pubspec.yaml: version number should be in a numeric format "MAJOR.MINOR.PATCH". ...

MAJOR.MINOR.PATCH

@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/pub#1156.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants