-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Environment
➜ highsupply git:(main) ✗ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale en_GB.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.58.2)
[✓] Connected device (1 available)
• No issues found!
➜ highsupply git:(main) ✗ dart --version
Dart SDK version: 2.13.4 (stable) (Wed Jun 23 13:08:41 2021 +0200) on "linux_x64"
➜ highsupply git:(main) ✗ flutter pub version
Pub 2.13.4
Ubuntu 20.04 LTS
Problem
as we know that standalone pub command is deprecated
and that snap install on Ubuntu does not expose the pub command at all, we have to access the command via either
- flutter pub
- dart pub
still when we do a
dart pub global activate --source path .
on a dart tool, we can not run the tool from commandline and we get error as:
➜ highlevel-flutter git:(codemagic_newdeploy) highsupply create .
/home/raveesh/snap/flutter/common/flutter/.pub-cache/bin/highsupply: 7: pub: not found
The content of /home/raveesh/snap/flutter/common/flutter/.pub-cache/bin/highsupply
is:
➜ highsupply git:(main) ✗ cat $(which highsupply)
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"
The generated sh file is trying to use the deprecated pub command instead of the respective dart or flutter pub command.
Going in the file and manually changing the line to:
dart pub global run high_supply:high_supply "$@"
solves the issue.
(changing it to flutter pub global run...
does not, because the global activate was called using dart pub global activate and it will result in error saying no active package for ...)
Expected behavior
1.
dart pub global activate --source path .
should generate:
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
dart pub global run high_supply:high_supply "$@"
2
flutter pub global activate --source path .
should generate:
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
flutter pub global run high_supply:high_supply "$@"
in $pub_cache
Actual behavior
1.
dart pub global activate --source path .
generates:
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"
2.
dart pub global activate --source path .
generates:
#!/usr/bin/env sh
# This file was created by pub v2.13.4.
# Package: high_supply
# Version: 0.0.0
# Executable: highsupply
# Script: high_supply
pub global run high_supply:high_supply "$@"