ignite-cli icon indicating copy to clipboard operation
ignite-cli copied to clipboard

Ignite --Version fails to work

Open munsterlander opened this issue 3 years ago • 2 comments

Installed per the instructions:

flutter pub global activate ignite_cli
Resolving dependencies...
+ args 2.3.1
+ charcode 1.3.1
+ collection 1.16.0
+ ignite_cli 0.4.0
+ io 1.0.3
+ logging 1.0.2
+ meta 1.8.0
+ path 1.8.2
+ process_run 0.12.3+2
+ prompts 2.0.0
+ pub_semver 2.1.1
+ source_span 1.9.1
+ string_scanner 1.1.1
+ synchronized 3.0.0+2
+ term_glyph 1.2.1
+ yaml 3.1.1
Building package executables...
Built ignite_cli:ignite.
Installed executable ignite.
Activated ignite_cli 0.4.0.

Running ignite --version as per the pub.dev instructions throws:

ignite --version
$ ignite --version:
Unhandled exception:
FileSystemException: Cannot open file, path = 'C:\flutter\flutter\.pub-cache\global_packages\ignite_cli\bin\..\pubspec.yaml' (OS Error: The system cannot find the file specified.
, errno = 2)
#0      _File.open.<anonymous closure> (dart:io/file_impl.dart:356:9)
<asynchronous suspension>
#1      getVersionFromPubspec (package:ignite_cli/commands/version_command.dart:19:25)
<asynchronous suspension>
#2      versionCommand (package:ignite_cli/commands/version_command.dart:10:9)
<asynchronous suspension>
#3      mainCommand (package:ignite_cli/main.dart:59:5)
<asynchronous suspension>
No active package ignite_cli.

Yet ignite create works fine.

munsterlander avatar Aug 19 '22 21:08 munsterlander

This is an issue because we cannot access the pubpsec file when installed globally. See my issue here

If you run --version locally or on a non-global context, it would work.

luanpotter avatar Feb 04 '23 22:02 luanpotter

We should either use this to lookup the pubspec file to get the version or generate the version at build-time like Melos does: https://github.com/invertase/melos/blob/main/packages/melos/lib/src/command_runner.dart#L102 https://github.com/invertase/melos/blob/main/packages/melos/lib/version.g.dart

spydon avatar Dec 08 '23 11:12 spydon