Skip to content

pub global activate in docker throws git related errors #3355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bsutton opened this issue Mar 22, 2022 · 1 comment
Closed

pub global activate in docker throws git related errors #3355

bsutton opened this issue Mar 22, 2022 · 1 comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bsutton
Copy link
Contributor

bsutton commented Mar 22, 2022

I'm running pub global activate in a docker container and it is displaying git related errors.

the pubspec.yaml doesn't reference git so I don't understand why pub is trying to get the git version no.

The error:

pub global activate dcli
The top level `pub` command is deprecated. Use `dart pub` instead.
Package dcli is currently active at version 1.17.5.
Resolving dependencies... (3.1s)
The package dcli is already activated at newest available version.
To recompile executables, first run `dart pub global deactivate dcli`.
Installed executables dcli, dcli_complete, dcli_install and dshell_upgrade.
Git command is not "git": Pub failed to run subprocess `git`: ProcessException: No such file or directory
  Command: git --version
Git command is not "git.cmd": Pub failed to run subprocess `git.cmd`: ProcessException: No such file or directory
  Command: git.cmd --version
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated dcli 1.17.5.

root@0f1b0ec0276f:/dcli/dcli# dart --version
Dart SDK version: 2.16.1 (stable) (Unknown timestamp) on "linux_x64"
root@0f1b0ec0276f:/dcli/dcli# 
``

The dockerfile

FROM ubuntu:20.04

WORKDIR /

ENV HOME=/home
RUN touch /home/.profile

RUN apt -y update && apt -y install apt-transport-https wget gpg && wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/dart.gpg
RUN echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | tee /etc/apt/sources.list.d/dart_stable.list

RUN apt -y update && apt -y upgrade && apt -y install vim wget dart

ENV PATH="$PATH:/usr/lib/dart/bin"

Add the entire dart project so we can run from the local filesystem

ADD .

CMD ["/bin/bash"]


You can run the above container from the root of any dart project and I would expect you to see the same results:

To build the docker file:

sudo docker build -f $dockerFilePath -t dcli:dev_dcli_cli .

sudo docker run -it dcli:dev_dcli_cli /bin/bash




@jonasfj jonasfj added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 24, 2022
@sigurdm
Copy link
Contributor

sigurdm commented Mar 25, 2022

I think this already was fixed in #3285

More specifically we stopped using Package.listFiles to find executables here: https://github.com/dart-lang/pub/pull/3285/files#diff-c3a7e19a3c22d18ae8a29e13bf0da3b7de8219552522569a8b07c1669e87d97fR89

Package.listFiles needs git to find the repository root to find all gitignores. But we don't need to take gitignores into account when listing executables of an activated package. Now this is only used during the pub publish flow.

Please reopen if there still is an issue.

@sigurdm sigurdm closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants