onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
236 stars 26 forks source link

dcli install assumes a wrong dcli path #151

Closed malkarouri closed 3 years ago

malkarouri commented 3 years ago

Describe the bug

Running dcli install returns with RunException running stat on a wrong path for dcli.

To Reproduce

Run on MacOS, zsh prompt:

dart pub global activate dcli dcli install

Expected behavior

No exceptions. Ability to import package successfully from script.

Logs

I have been trying to follow the example at https://bsutton.gitbook.io/dcli/articles/build-console-apps-in-dart, executed the installation steps and tried to run the script, which gave me an error

❯ ./hello_world.dart Error: Couldn't resolve the package 'dcli' in 'package:dcli/dcli.dart'. hello_world.dart:3:8: Error: Not found: 'package:dcli/dcli.dart' import 'package:dcli/dcli.dart'; ^

I went back to the installation steps and found that I had an error on the dcli install step:

❯ dcli install Hang on a tick whilst we install DCli 1.5.3

You must first install dart. See the install instructions at: https://dart.dev/get-dart Found existing install at: /Users/muhammadalkarouri/.dcli.

Updating Template directory in: /Users/muhammadalkarouri/.dcli/templates.

dcli found in : /Users/muhammadalkarouri/.pub-cache/bin/dcli. RunException: stat -L -c %a %G %U /usr/local/bin/dcli exit: 1 reason: The command [stat] with args [-L, -c, %a %G %U, /usr/local/bin/dcli] failed with exitCode: 1 Stacktrace: wait_for_ex.dart : waitForEx : 48 runnable_process.dart : RunnableProcess.processUntilExit : 446 runnable_process.dart : RunnableProcess.run : 185 run.dart : start : 240 string_as_process.dart : StringAsProcess.toList : 293 string_as_process.dart : StringAsProcess.firstLine : 361 is.dart : _Is._checkPermission : 187 is.dart : _Is.isWritable : 152 is.dart : isWritable : 90 install.dart : InstallCommand.symlinkDCli : 231

I am assuming there is an error in the install that is related to the fact that dcli resides in /Users/muhammadalkarouri/.pub-cache/bin/dcli while the stat command is run on /usr/local/bin/dcli.

Run dcli doctor: From the cli run dcli doctor

❯ dcli doctor
DCli version      1.5.3

OS                macos
OS Version        10.16
path separator    /

dart version      2.13.1

dcli path         /<HOME>/.pub-cache/bin/dcli
dart exe path     /usr/local/bin/dart
dart path         /usr/local/bin/dart                                     which: /usr/local/bin/dart
compiler          using 'dart compile exe'

pub               using 'dart pub'

package Config    not passed

PATH
                  /<HOME>/.pyenv/versions/miniconda3-latest/bin
                  /<HOME>/.pyenv/versions/miniconda3-latest/condabin
                  /usr/local/sbin
                  /<HOME>/.local/bin
                  /<HOME>/.pyenv/shims
                  /<HOME>/.pyenv/bin
                  /usr/local/opt/tcl-tk/bin
                  /<HOME>/.jenv/shims
                  /<HOME>/.jenv/bin
                  /<HOME>/bin
                  /usr/local/bin
                  /<HOME>/.cargo/bin
                  /<HOME>/.poetry/bin
                  /usr/local/bin
                  /usr/bin
                  /bin
                  /usr/sbin
                  /sbin
                  /Library/TeX/texbin
                  /usr/local/share/dotnet
                  /<HOME>/Projects/ded/~/.dotnet/tools
                  /Library/Apple/usr/bin
                  /Library/Frameworks/Mono.framework/Versions/Current/Com
                  /<HOME>/.local/bin
                  /usr/local/opt/fzf/bin
                  /<HOME>/.pub-cache/bin

$SHELL            /usr/local/bin/zsh
detected SHELL    zsh
Shell Start Scrip not found

dart location(s)
                  /usr/local/bin/dart

permissions
HOME              rwxr-xr-x <user>:staff /<HOME>
.dcli             rwxr-xr-x <user>:staff /<HOME>/.dcli
cache             rwxr-xr-x <user>:staff /<HOME>/.dcli/cache
templates         rwxr-xr-x <user>:staff /<HOME>/.dcli/templates

Additional context

While I am an experienced developer, this is my first foray in dart.

bsutton commented 3 years ago

I've just release 1.5.4 that fixes this issue.

On Mon, 7 Jun 2021, 8:58 pm Muhammad Alkarouri, @.***> wrote:

Describe the bug

Running dcli install returns with RunException running stat on a wrong path for dcli.

To Reproduce

Run on MacOS, zsh prompt:

dart pub global activate dcli dcli install

Expected behavior

No exceptions. Ability to import package successfully from script.

Logs

I have been trying to follow the example at https://bsutton.gitbook.io/dcli/articles/build-console-apps-in-dart, executed the installation steps and tried to run the script, which gave me an error

❯ ./hello_world.dart Error: Couldn't resolve the package 'dcli' in 'package:dcli/dcli.dart'. hello_world.dart:3:8: Error: Not found: 'package:dcli/dcli.dart' import 'package:dcli/dcli.dart'; ^

I went back to the installation steps and found that I had an error on the dcli install step:

❯ dcli install Hang on a tick whilst we install DCli 1.5.3

You must first install dart. See the install instructions at: https://dart.dev/get-dart Found existing install at: /Users/muhammadalkarouri/.dcli.

Updating Template directory in: /Users/muhammadalkarouri/.dcli/templates.

dcli found in : /Users/muhammadalkarouri/.pub-cache/bin/dcli. RunException: stat -L -c %a %G %U /usr/local/bin/dcli exit: 1 reason: The command [stat] with args [-L, -c, %a %G %U, /usr/local/bin/dcli] failed with exitCode: 1 Stacktrace: wait_for_ex.dart : waitForEx : 48 runnable_process.dart : RunnableProcess.processUntilExit : 446 runnable_process.dart : RunnableProcess.run : 185 run.dart : start : 240 string_as_process.dart : StringAsProcess.toList : 293 string_as_process.dart : StringAsProcess.firstLine : 361 is.dart : _Is._checkPermission : 187 is.dart : _Is.isWritable : 152 is.dart : isWritable : 90 install.dart : InstallCommand.symlinkDCli : 231

I am assuming there is an error in the install that is related to the fact that dcli resides in /Users/muhammadalkarouri/.pub-cache/bin/dcli while the stat command is run on /usr/local/bin/dcli.

Run dcli doctor: From the cli run dcli doctor

❯ dcli doctor

DCli version 1.5.3

OS macos

OS Version 10.16

path separator /

dart version 2.13.1

dcli path //.pub-cache/bin/dcli

dart exe path /usr/local/bin/dart

dart path /usr/local/bin/dart which: /usr/local/bin/dart

compiler using 'dart compile exe'

pub using 'dart pub'

package Config not passed

PATH

              /<HOME>/.pyenv/versions/miniconda3-latest/bin

              /<HOME>/.pyenv/versions/miniconda3-latest/condabin

              /usr/local/sbin

              /<HOME>/.local/bin

              /<HOME>/.pyenv/shims

              /<HOME>/.pyenv/bin

              /usr/local/opt/tcl-tk/bin

              /<HOME>/.jenv/shims

              /<HOME>/.jenv/bin

              /<HOME>/bin

              /usr/local/bin

              /<HOME>/.cargo/bin

              /<HOME>/.poetry/bin

              /usr/local/bin

              /usr/bin

              /bin

              /usr/sbin

              /sbin

              /Library/TeX/texbin

              /usr/local/share/dotnet

              /<HOME>/Projects/ded/~/.dotnet/tools

              /Library/Apple/usr/bin

              /Library/Frameworks/Mono.framework/Versions/Current/Com

              /<HOME>/.local/bin

              /usr/local/opt/fzf/bin

              /<HOME>/.pub-cache/bin

$SHELL /usr/local/bin/zsh

detected SHELL zsh

Shell Start Scrip not found

dart location(s)

              /usr/local/bin/dart

permissions

HOME rwxr-xr-x :staff /

.dcli rwxr-xr-x :staff //.dcli

cache rwxr-xr-x :staff //.dcli/cache

templates rwxr-xr-x :staff //.dcli/templates

Additional context

While I am an experienced developer, this is my first foray in dart.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/151, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32ODSDJP6TUJ2E5R4XXLTRSQ65ANCNFSM46HNA3SA .

malkarouri commented 3 years ago

Haven't tried 1.5.4, but 1.5.5 seems to be the latest. Installation works smoothly and was able to run the script. Thanks.

bsutton commented 3 years ago

Good to here and thanks for the update.

On Wed, 9 Jun 2021, 9:48 pm Muhammad Alkarouri, @.***> wrote:

Haven't tried 1.5.4, but 1.5.5 seems to be the latest. Installation works smoothly and was able to run the script. Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/151#issuecomment-857627124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OE2KAGRTRV27Q2ZXELTR5IHTANCNFSM46HNA3SA .