stacked icon indicating copy to clipboard operation
stacked copied to clipboard

[bug]: Local activation of stacked-cli on windows throws format exception

Open sebastianbuechler opened this issue 1 year ago • 4 comments

Describe the bug

According to here https://github.com/Stacked-Org/cli#running-the-code I activated a local fork of the stacked-cli with dart pub global activate --source path .. But when I want to use the local version it fails with the error FormatException: Could not parse ""C:\Users\myUser\Dev\Flutter\cli"".

To reproduce

  1. Open local fork of the stacked-cli
  2. Register it: dart pub global activate --source path .
  3. Try to create a new app: stacked create app testapp
  4. Receive FormatException: Could not parse ""C:\Users\myUser\Dev\Flutter\cli"".

Expected behavior

Throw no error.

Screenshots

No response

Additional Context

stacked --version gives me as a result "C:\Users\myUser\Dev\Flutter\cli".

The runPubGloablList returns for me [stacked 3.4.1, stacked_cli 1.10.0 at path "C:\Users\myUser\Dev\Flutter\cli"] and thus the parsing of the version of the package fails.

If I change in pub_services.dart from: version = package.split(' ').last() To: version = package.split(' ').elementAt(1);

It works again for me. Would that work on other systems as well?

sebastianbuechler avatar Jun 24 '23 10:06 sebastianbuechler

Are you trying to install Stacked CLI for development ?

ferrarafer avatar Jun 27 '23 12:06 ferrarafer

Are you trying to install Stacked CLI for development ?

Yes, as described here: https://github.com/Stacked-Org/cli#running-the-code

It does not appear when installing it regularly as a consumer.

I'm using a Windows platform.

sebastianbuechler avatar Jun 27 '23 14:06 sebastianbuechler

I will review this documentation during the week, but I'm not using the CLI that way for development. You can do the following on the root of the CLI repository:

dart run bin/stacked.dart create app my_app

Modify the command to do what you want.

ferrarafer avatar Jul 04 '23 02:07 ferrarafer

I will review this documentation during the week, but I'm not using the CLI that way for development. You can do the following on the root of the CLI repository:

dart run bin/stacked.dart create app my_app

Modify the command to do what you want.

That explains why you have not encountered this bug. Sure, works as well. Just wanted to add that this fix would enable both ways to work.

sebastianbuechler avatar Jul 06 '23 07:07 sebastianbuechler