felangel / mason

Tools which allow developers to create and consume reusable templates called bricks.

Home Page:https://docs.brickhub.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix: dart pub global activate mason_cli not working

ljoly83 opened this issue · comments

Description
I can't install mason_cli.
The last version is 0.1.0-dev.52.

Steps To Reproduce

  1. in dos command execute dart pub global activate mason_cli not working
  2. Error:
    Failed to build mason_cli:mason:
    AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason_cli-0.1.0-dev.40/lib/src/commands/bundle.dart:152:242: Error: The property 'camelCase' is defined in multiple extensions for 'String' and neither is more specific.
    Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
    "// GENERATED CODE - DO NOT MODIFY BY HAND\n// ignore_for_file: type=lint, implicit_dynamic_list_literal, implicit_dynamic_map_literal, inference_failure_on_collection_literal\n\nimport 'package:mason/mason.dart';\n\nfinal ${bundle.name.camelCase}Bundle = MasonBundle.fromJson(<String, dynamic>${json.encode(bundle.toJson())});",

^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason-0.1.0-dev.41/lib/src/string_case_extensions.dart:6:14: Context: This is one of the extension members.
String get camelCase => ReCase(this).camelCase;
^^^^^^^^^

.......

Hi @ljoly83 👋
Thanks for opening an issue!

Based on the snippet, it looks like you have mason_cli v0.1.0-dev.40 which is quite old. Have you tried deactivating and reactivating:

dart pub global deactivate mason_cli
dart pub global activate mason_cli

Let me know if that helps 👍

Hi @felangel,
Thanks for the reply.
It doesn't worked.
Indeed, mason_cli wasn't installed at firt try, so dart pub global deactivate mason_cli does nothing.
I don't have any version before, I just tried to installed for the first time 8 days ago, so I think it should install the latest version.

@ljoly83 based on your logs it looks like you have an old version cached in AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason-0.1.0-dev.41. Can you try deleting that directory and trying again?

@felangel
You are right, there were 4 folders with mason. I deleted them and try again and this is the log (the same)

dart pub global activate mason_cli
Resolving dependencies...
+ archive 3.4.2 (3.4.6 available)
+ args 2.3.1 (2.4.2 available)
+ async 2.9.0 (2.11.0 available)
+ checked_yaml 2.0.1 (2.0.3 available)
+ cli_util 0.3.5 (0.4.0 available)
+ collection 1.17.0 (1.18.0 available)
+ convert 3.1.0 (3.1.1 available)
+ crypto 3.0.2 (3.0.3 available)
+ file 6.1.4 (7.0.0 available)
+ http 0.13.5 (1.1.0 available)
+ http_parser 4.0.2
+ js 0.6.5 (0.6.7 available)
+ json_annotation 4.7.0 (4.8.1 available)
+ mason 0.1.0-dev.41 (0.1.0-dev.51 available)
+ mason_api 0.1.0-dev.9 (0.1.0-dev.10 available)
+ mason_cli 0.1.0-dev.40 (0.1.0-dev.52 available)
+ mason_logger 0.2.4 (0.2.10 available)
+ meta 1.11.0
+ mustache_template 2.0.0
+ path 1.8.3
+ platform 3.1.0 (3.1.3 available)
+ pointycastle 3.7.3
+ pool 1.5.1
+ process 4.2.4 (5.0.1 available)
+ pub_semver 2.1.4
+ pub_updater 0.2.4 (0.4.0 available)
+ recase 4.1.0
+ source_span 1.9.1 (1.10.0 available)
+ stack_trace 1.10.0 (1.11.1 available)
+ string_scanner 1.1.1 (1.2.0 available)
+ term_glyph 1.2.1
+ typed_data 1.3.2
+ yaml 3.1.1 (3.1.2 available)
Downloading mason_cli 0.1.0-dev.40...
Downloading mason_api 0.1.0-dev.9...
Downloading mason 0.1.0-dev.41...
Downloading mason_logger 0.2.4...
Building package executables...
Failed to build mason_cli:mason:
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason_cli-0.1.0-dev.40/lib/src/commands/bundle.dart:152:242: Error: The property 'camelCase' is defined in multiple extensions for 'String' and neither is more specific.
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
    "// GENERATED CODE - DO NOT MODIFY BY HAND\n// ignore_for_file: type=lint, implicit_dynamic_list_literal, implicit_dynamic_map_literal, inference_failure_on_collection_literal\n\nimport 'package:mason/mason.dart';\n\nfinal ${bundle.name.camelCase}Bundle = MasonBundle.fromJson(<String, dynamic>${json.encode(bundle.toJson())});",


 ^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason-0.1.0-dev.41/lib/src/string_case_extensions.dart:6:14: Context: This is one of the extension members.
  String get camelCase => ReCase(this).camelCase;
             ^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/recase-4.1.0/lib/recase.dart:115:14: Context: This is one of the extension members.
  String get camelCase => ReCase(this).camelCase;
             ^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason_cli-0.1.0-dev.40/lib/src/commands/new.dart:45:37: Error: The property 'snakeCase' is defined in multiple extensions for 'String' and neither is more specific.
Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
    final name = results.rest.first.snakeCase;
                                    ^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/mason-0.1.0-dev.41/lib/src/string_case_extensions.dart:36:14: Context: This is one of the extension members.
  String get snakeCase => ReCase(this).snakeCase;
             ^^^^^^^^^
AppData/Local/Pub/Cache/hosted/pub.dartlang.org/recase-4.1.0/lib/recase.dart:121:14: Context: This is one of the extension members.
  String get snakeCase => ReCase(this).snakeCase;

@ljoly83 what version of dart/flutter are you using? I suspect you're on an really old version and pub isn't able to allow you to install the latest stable version. The latest version of Mason CLI requires Dart >= 2.19.0

Hey,
I finally installed mason.
The reason is that I use fvm https://fvm.app/ to manage multiple version of flutter on a single computer.
So I did
fvm dart pub global activate mason_cli
and it worked.
Altough flutter command was no more available after fvm install, dart was avalaible.
May be you can add this notice in the mason_cli documentation.
Many thanks for your help!