Skip to content
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

Help users get flutter added to path #15154

Open
mit-mit opened this issue Mar 5, 2018 · 10 comments
Open

Help users get flutter added to path #15154

mit-mit opened this issue Mar 5, 2018 · 10 comments
Labels
P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@mit-mit
Copy link
Member

mit-mit commented Mar 5, 2018

Steps to Reproduce

We are seeing lots of upstream issues in the IDEs boiling down to the root issue of users not having flutter correctly in path (for example, #15066, Dart-Code/Dart-Code#633).

It would be good if doctor could check for this.

It would be even better if the flutter tool could offer to add to path on behalf of the user.

@mit-mit mit-mit added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 5, 2018
@xster
Copy link
Member

xster commented Mar 5, 2018

Another approach would be integrating Flutter into package managers. Then users wouldn't need to do one off path configurations.

#14050

@mit-mit mit-mit changed the title Help users get flutter adding to path Help users get flutter added to path Mar 5, 2018
@devoncarew
Copy link
Member

Some tools offer options for installing into system directories that are already on the user's path, like /usr/local/bin/. These are generally privileged locations - on macos they require the user to ok the write w/ a system prompt. VSCode / IntelliJ / Android Studio all have menu options to install into the system path, and write small scripts into usr/local/bin. Here's the /usr/local/bin/code script:

#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

function realpath() { /usr/bin/python -c "import os,sys; print os.path.realpath(sys.argv[1])" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?

@devoncarew
Copy link
Member

So, from the flutter cli, we'd do something which would offer to install it into a system path, and write a trampoline script there which would invoke <flutter-sdk>/bin/flutter.

@devoncarew
Copy link
Member

another approach would be integrating Flutter into package managers

That would work as well, and be very nice for package managers that are broadly used (brew in the mac, ...).

@mrmcq2u
Copy link

mrmcq2u commented Mar 5, 2018

Flatpak sdk extensions would also solve this - https://blogs.gnome.org/chergert/2018/01/20/builder-happenings-for-january/

@DanTup
Copy link
Contributor

DanTup commented Mar 5, 2018

Some tools offer options for installing into system directories that are already on the user's path

I don't know if there's an equiv for this on Windows (most things tend to modify PATH rather than putting links into existing places).

v2.10.0 (currently beta) of Dart Code now gives the user a Locate SDK option when this message appears with a folder picker which I expect will somewhat resolve these issues. My preference is still to detect from PATH (it's self-maintaining, unlike writing the SDK path to settings) but based on the issues raised, I think it's giong to be complicated (for ex. there are people that have flutter in their path yet when the open Code, it gets a different path (for example some custom shells handle path differently).

@DanTup
Copy link
Contributor

DanTup commented Mar 15, 2018

FWIW, Dart Code handles this better now:

prompt

The Locate SDK button opens a folder picker and lets the user browse to their SDK (and validates its an SDK before writing it to global settings).

There's a remaining bug I found (Dart-Code/Dart-Code#693) when we don't find Flutter but do find Dart, which is fixed for next version.

It would be good if doctor could check for this.

It would be even better if the flutter tool could offer to add to path on behalf of the user.

The main issue that was coming up was from people that had added to PATH but then either didn't reboot (or whatever is required for it to get to Code) or had just set the PATH in a way that it only applied to their shell. I don't think either of the above would address this (since from within the terminal, it seems like it's all good - the fact that flutter doctor works suggests that to the process it'll seem like it is definitely on PATH).

So, unless this is affecting other IDEs (and there'a fix that could address those main two issues mentioned above), I'm not sure if there's much worth doing here.

@DanTup
Copy link
Contributor

DanTup commented Jun 4, 2018

Since adding the Locate SDK button to the message (+ suggesting people restart) and the zip files with a the flutter_console.bat I haven't really had any complaints about paths at all. I don't know if this is still an issue we feel we need to do anything about?

@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

Similar to #8029

@zoechi
Copy link
Contributor

zoechi commented Feb 21, 2019

Related to #9401

@zoechi zoechi added this to the Goals milestone Feb 21, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 8, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 8, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 10, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Jan 11, 2020
@jmagman jmagman added this to Awaiting triage in Tools - installer / upgrade review via automation Jan 11, 2020
@christopherfujino christopherfujino moved this from Awaiting triage to Engineer reviewed in Tools - installer / upgrade review Jan 23, 2020
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@flutter-triage-bot flutter-triage-bot bot added team-tool Owned by Flutter Tool team triaged-tool Triaged by Flutter Tool team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
Development

No branches or pull requests

8 participants