invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.12k stars 199 forks source link

fix: Flutter SDK is not available when use dart pub gloabl activate melos in new system #574

Closed jiechic closed 9 months ago

jiechic commented 1 year ago

Is there an existing issue for this?

Version

3.1.1

Description

I install fvm and melos in the docker image,setting sdkPath in the melos.yaml ,when i run melos bs on gitlab runner,it's show the log error

$ echo y | fvm use && fvm flutter precache
Project now uses Flutter [3.10.6]
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Flutter assets will be downloaded from https://storage.flutter-io.cn/. Make sure you trust this source!
$ melos bootstrap
Resolving dependencies...
Because okmm depends on flutter_test from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.
Flutter users should run `flutter pub get` instead of `dart pub get`.

Steps to reproduce

some setup is on the docker build

  1. install dart
    
    RUN wget --quiet --output-document=dart.deb \
    "https://storage.googleapis.com/dart-archive/channels/stable/release/latest/linux_packages/dart_3.1.0-1_amd64.deb" && \
    dpkg -i dart.deb && \
    rm --force dart.deb

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

2. install melos and fvm
```dockerfile
RUN dart pub global activate fvm && \
    dart pub global activate melos && \
    dart pub global activate junitreport && \
    dart pub global activate full_coverage

ENV PATH="$PATH:/root/.pub-cache/bin"
  1. precache flutter version
    ENV FLUTTER_VERSION=3.10.6
    RUN fvm install $FLUTTER_VERSION && \
    fvm spawn $FLUTTER_VERSION precache

the follow setup is on gitlab runner

  1. echo y | fvm use && fvm flutter precache
  2. melos bootstrap

Expected behavior

when runner melos will success pub get packages

Screenshots

image

Additional context and comments

when i install melos and fvm on local clean system with mac

  1. brew install dart
  2. dart pub global activate fvm
  3. dart pub global activate melos
  4. git clone ...project.git
  5. cd project
  6. fvm use (create link for .fvm/flutter_sdk)
  7. melos bs (error on this setup like the log)
  8. fvm dart pub global run melos (error on this setup like the log)
  9. fvm flutter pub global run melos (success pub get for all packages)
  10. melos bs (now is success for all the next setup with any type run meols)

if i install melos with dart pub global on clean system ,it will be error. if i run flutter pub global run melos or install with flutter pub global activate melos then run , i will be success for all time next,when i deactivate melos and reactivate melos with dart pub global activate melos ,it's success but error on system reboot

okki-jk commented 1 year ago

I got the same problem

jiechic commented 9 months ago

because root project use flutter but dart run melos have found it i change root project to dir app, then the root project is only dart project it fix

jiechic commented 9 months ago

it's the same problem #616