NativeScript / NativeScript/nativescript-cli

`tns run android` appends to .bash_profile/.zprofile even if denied for local build configuration

Offen
#5,082 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
1.1k
Forks
204
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
8

Beschreibung

Environment

  • CLI: 6.1.2
  • Cross-platform modules: 6.0.7
  • Android Runtime: 6.1.2
  • iOS Runtime: 6.1.1
  • Plugin(s): -

Describe the bug
When running tns run android and if the environment is not properly set up, the automatic environment setup script for a local build will automatically append JAVA_HOME and ANDROID_HOME, as well as ANDROID_SDK_ROOT to .bash_profile / .zprofile even if install steps 3 and 4 are rejected.

This happens every time the installer is run up to these steps which leads to a spammed .bash_profile / .zprofile if the installer needs to be aborted or restarted a couple of times. This will also overwrite previously set variables.

The output of the cli is as follows:

Step 3 of 12:
Allow the script to install Open JDK 8?
(Y)es/(N)o
n
You have chosen not to install Open JDK 8. Some features of NativeScript may not work correctly if you haven't already installed it
Set JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Step 4 of 12:
Allow the script to install Android SDK?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
n
You have chosen not to install Android SDK. Some features of NativeScript may not work correctly if you haven't already installed it
Set ANDROID_HOME=/usr/local/share/android-sdk
Set ANDROID_SDK_ROOT=/usr/local/share/android-sdk
Configuring your system for Android development... This might take some time, please, be patient.
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration
zsh:1: no such file or directory: /usr/local/share/android-sdk/tools/bin/sdkmanager
WARNING: There seem to be some problems with the Android configuration

To Reproduce

  1. Have an incomplete environment set up (e.g. do not have ANDROID_HOME as environment variable set)
  2. run tns run android in your project
  3. choose configure local build
  4. deny all steps 3 and 4
  5. check .bashprofile / .zprofile

Expected behavior
Have the setup script not append variables in .bashprofile / .zprofile or replace the variables if installation steps 3 and 4 are rejected.

Additional context
My .bash_profile after I had to retry the installer a couple of times:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Ho$
export ANDROID_HOME=/usr/local/share/android-sdk
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem tns run android-CLI-Ablauf und der automatischen Umgebungseinrichtung, die von configure local build verwendet wird; reproduziere die Prompt-Sequenz, wobei die Schritte 3 und 4 abgelehnt werden. Verfolge, wann JAVA_HOME, ANDROID_HOME und ANDROID_SDK_ROOT in .bash_profile oder .zprofile geschrieben werden. Als erledigt gilt, dass abgelehnte Installationsschritte diese Variablen nicht anhängen oder ersetzen, auch nach wiederholten Versuchen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, javascript
Bereich
cli, mobile
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.