-
Notifications
You must be signed in to change notification settings - Fork 211
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
fix: sdkPath
is not working when flutter is not on the global path
#616
Comments
Ok I get it... This means that a subsystem ignores the sdkPath parameter and expects to use the system configuration. |
Thanks for a well written issue, so it works for Melos 3.1.1? |
yes, it works fine in 3.1.1 |
yes, I had inspected the PR too and found nothing. I'll try to make a video presentation. |
I just tried to replicate your setup and it works fine for me (so I probably failed to replicate it)... |
My previous isntallation was :
Case 1:
Case 2:
Case 3:
I haven't had time to do another test since it's working again for me. |
Ah right, I forgot to unset the environment Flutter. |
I don't really know, I'm fairly new to the flutter world and I've just started on a fairly complex project. I have my main project and 5 internal packages on it. |
@Ppito it's a quite new feature so you're probably not using it, but can you post your full |
Okay, I'll warn you right now, the configuration isn't mine. 🤣 name: my_app
packages:
- .
- packages/**
sdkPath: .fvm/flutter_sdk
command:
clean:
hooks:
post: melos exec --flutter -- "flutter clean"
bootstrap:
runPubGetInParallel: false
usePubspecOverrides: true
scripts:
# [Format] -----------------------------------------------------------------------------------------------------------
format:
run: melos run format:dart --no-select && melos run format:flutter --no-select
description: Run Dart/Flutter formats in all packages.
format:dart:
run: melos exec --concurrency=1 -- "dart format --output=none --set-exit-if-changed ."
description: Run Dart format in all dart packages.
packageFilters:
flutter: false
ignore: "*example*"
format:flutter:
run: melos exec --concurrency=1 -- "dart format --output=none --set-exit-if-changed ."
description: Run Flutter format in all flutter packages.
packageFilters:
flutter: true
ignore: "*example*"
# [Analyze] ----------------------------------------------------------------------------------------------------------
analyze:
run: melos run analyze:dart --no-select && melos run analyze:flutter --no-select
description: Run Dart/Flutter analyzes in all packages.
analyze:dart:
run: melos exec --concurrency=1 -- "dart analyze ."
description: Run Dart analyze in all dart packages.
packageFilters:
flutter: false
ignore: "*example*"
analyze:flutter:
run: melos exec --concurrency=1 -- "flutter analyze ."
description: Run Flutter analyze in all flutter packages.
packageFilters:
flutter: true
ignore: "*example*"
# [Generate] ---------------------------------------------------------------------------------------------------------
generate:
run: melos run generate:dart --no-select && melos run generate:flutter --no-select
description: Run Dart/Flutter build_runner in all packages.
generate:dart:
run: melos exec --concurrency=1 -- "dart pub run build_runner build --delete-conflicting-outputs"
description: Run Dart build_runner in all dart packages.
packageFilters:
flutter: false
ignore: "*example*"
dependsOn: build_runner
generate:flutter:
run: melos exec --concurrency=1 -- "flutter pub run build_runner build --delete-conflicting-outputs"
description: Run Flutter build_runner in all flutter packages.
packageFilters:
flutter: true
ignore: "*example*"
dependsOn: build_runner
# [Test] -------------------------------------------------------------------------------------------------------------
test:
run: melos run test:dart --no-select && melos run test:flutter --no-select
description: Run Dart/Flutter tests in all packages.
test:dart:
run: melos exec --concurrency=1 --fail-fast -- "dart test"
description: Run Dart test in all dart packages.
packageFilters:
flutter: false
dirExists: test
ignore: "*example*"
test:flutter:
run: melos exec --concurrency=1 --fail-fast -- "flutter test --coverage --test-randomize-ordering-seed random"
description: Run Flutter test in all flutter packages.
packageFilters:
flutter: true
dirExists: test
ignore: "*example*"
test:flutterWithHtmlCoverage:
run: melos exec --concurrency=1 --fail-fast "flutter test --coverage --test-randomize-ordering-seed random --reporter expanded && genhtml coverage/lcov.info --output-directory coverage/html && open coverage/html/index.html"
description: Run Flutter test in all flutter packages with HTML coverage.
packageFilters:
flutter: true
dirExists: test
ignore: "*example*"
# [Flavor] -----------------------------------------------------------------------------------------------------------
dev:
run: melos run qa:dev --no-select
description: Run Dev environment.
mock:
run: melos run qa:mock --no-select
description: Run Mock environment.
staging:
run: melos run qa:staging --no-select
description: Run Staging environment.
production:
run: melos exec -- "flutter run --flavor production"
description: Run with Production flavor in Production environment.
packageFilters:
scope: "my_app"
qa:dev:
run: melos exec -- "flutter run --flavor qa -a ENV=dev"
description: Run with QA flavor in Dev environment.
packageFilters:
scope: "my_app"
qa:mock:
run: melos exec -- "flutter run --flavor qa -a ENV=mock"
description: Run with QA flavor in Mock environment.
packageFilters:
scope: "my_app"
qa:staging:
run: melos exec -- "flutter run --flavor qa -a ENV=test"
description: Run with QA flavor in Staging environment.
packageFilters:
scope: "my_app"
# [UI] ---------------------------------------------------------------------------------------------------------------
widgetbook:
run: melos exec -- "flutter run --device-id chrome -a ENV=dev"
description: Run widgetbook on web.
packageFilters:
scope: "pkg_widgetbook" |
Alright, no common dependencies. And everything looks in order, except that it seems like you are having one package in the root, which is not recommended since the workspace pubspec lives in the root and then will collide with the one for the package/app that you have there, so if I were you I would move that into either |
sdkPath
is not working when flutter is not on the global path
It's not really a package on the root, it's my main application ... ^^" |
Then it should be in a directory named the same as your app inside of |
So, instead of this :
I should have this:
|
@Ppito exactly :) |
We've strayed from the original topic, but thanks for the advice. 😁 |
the same problem #574 |
Hey there 👋🏼 Local contextOS: Windows 11 Setup casesCase 1: When the root package (the one that includes Case 2: When the root package (the one that includes Case 2 is the approach I am using now as a workaround. |
I faced the same issue but fixed it by matching the global version of melos to the one in my |
Hi, we face with the same issue FVM for this project:
in melos.yaml we have sdkPath: .fvm/flutter_sdk But fvm has global version Flutter 2.5.2:
Aka melos does not respect |
There are a few different issues mentioned here. But it seems they are most likely a mismatch on the Flutter/Dart version running the melos command vs the one that is in the FVM has a command to help force the version that runs the commands called To double-check this, you can do the following: $ fvm exec dart --version
$ dart --version These versions are most likely mismatched. ✋ @spydon let me know if there is anything I can do to make things easier for you guys. |
@leoafarias I'm not sure if there is anything we can do from our side? If the melos binary is installed with another Flutter version I don't think we can change which sdk it executes itself with, only the commands that will be run from within melos. 🤔 |
@spydon FVM has the same problem; as you imagine, FVM can change the SDK that is used to run itself 🤯 The only solution I have found is to distribute a compiled binary. This might minimize these problems, and based on some issues I have seen here, it might be the solution for "environment configuration" problems. If this makes sense to explore, we can talk offline, and I can create an initial PR for this. |
Aah yeah, of course!
You'd have to distribute it outside of pub then I guess? That seems like it would add a lot of maintenance effort. 🤔
Yeah, let's have a chat! |
hello @leoafarias @spydon @jiechic @Ppito @tenhobi I have been trying to run the melos command in azure devops pipeline. I keep getting command not found export PATH="$PATH":"$HOME/.pub-cache/bin" Activated melos 3.4.0. after running this export PATH="$PATH":"$HOME/.pub-cache/bin" it still fails. can someone guide me on how they successsfully make the melos command works |
If you are using Fvm I think you have to activate melos on Fvm melos and then run it under Fvm so you have correct dart and flutter based on your project etc. fvm exec melos run... Do you do this? |
thanks, do you have a specific command for fvm to activate and run melos. even using dart , fvm dart or fvm flutter to activate global melos. it keeps giving command not found. fvm exec melos bootstrap /bin/sh: 1: melos: not found ##[error]Bash exited with code '127'.fvm exec melos run /bin/sh: 1: melos: not found ##[error]Bash exited with code '127'. |
Should be this, no? Then you should be able to run it using i.e.
|
Is there an existing issue for this?
Version
>=3.2.0
Description
Hi,
I use fvm to manage my various Flutter versions and until melos version 3.1.1 I had no particular problem with using the sdkPath option in my melos.yml configuration file.
Since I updated melos on 3.2.0 (same problem on 3.4.0) this option no longer works with the message
The Flutter SDK is not available.
.Steps to reproduce
sdkPath: .fvm/flutter_sdk
onmelos.yaml
Expected behavior
The specified SDK path has been found and the command is running.
Screenshots
No response
Additional context and comments
I've looked through the PR and searched the entire project (on tag 3.2.0 and melos-latest), but I can't figure out what caused the problem or how to solve it.
I work on Windows 11 (without WSL), but like I said, everything work fine with melos 3.1.1.
I tried mmany configuration
I also tried to use the env variable
MELOS_SDK_PATH
The text was updated successfully, but these errors were encountered: