NativeScript / NativeScript/nativescript-cli

`doctor` and `run` fail on WSL2 with Android SDK installed on Windows

オープン
#5,819 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug-pending-triage
主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
8

説明

Issue Description

NativeScript CLI wrongly assumes adb and emulator as executable names instead of adb.exe and emulator.exe

As a workaround, you can create a symlink named adb and emulator pointing to their equivalents with the .exe extension

Reproduction
  1. install Android SDK on Windows to C:\android\sdk
  2. setup WSL2 with NativeScript CLI
  3. set ANDROID_HOME to C:\android\sdk, ANDROID_SDK_ROOT to $ANDROID_HOME and add $ANDROID_HOME/platform-tools to $PATH
  4. run ns run android --device <device id> or ns doctor android
  5. the command fails because it tests adb and emulator instead of adb.exe and emulator.exe
Relevant log output (if applicable)
ns --log trace run android --device emulator-5554

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
                        *
*  The "TRACE" log level might print some sensitive data like secrets or access tokens in request URLs. Be careful when you share this output.  *
*
                        *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Looking for project in '/home/szymek/projects/nativescriptjazda/tamagoczi'
Project directory is '/home/szymek/projects/nativescriptjazda/tamagoczi'.
Initializing project identifiers. Config:  {
  id: 'org.nativescript.tamagoczi',
  appPath: 'src',
  appResourcesPath: 'App_Resources',
  android: { v8Flags: '--expose_gc', markingMode: 'none' },
  cli: { packageManager: 'bun' }
}
Loading extensions.
Collecting system information...
System information:
{
  "platform": "linux",
  "shell": "/bin/bash",
  "os": "Linux DESKTOP-RJEK15K 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux\n",
  "procArch": "x64",
  "nodeVer": "21.7.3",
  "npmVer": "10.5.0",
  "nodeGypVer": "10.2.0",
  "nativeScriptCliVersion": "8.8.2",
  "gitVer": "2.25.1",
  "dotNetVer": null,
  "javacVersion": "17.0.12",
  "javaVersion": "17.0.12",
  "javaPath": "java",
  "adbVer": null,
  "androidInstalled": true,
  "monoVer": null,
  "gradleVer": null,
  "isAndroidSdkConfiguredCorrectly": false,
  "xcodeprojLocation": null,
  "itunesInstalled": false,
  "isCocoaPodsWorkingCorrectly": false,
  "isCocoaPodsUpdateRequired": false,
  "pythonInfo": null
}
Current CLI version:  8.8.2
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/home/szymek/projects/nativescriptjazda/tamagoczi/hooks' ]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
AfterHookName for command resolveCommand is after-resolveCommand
Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.
The stackTrace of the location trying to handle SIGINT is (note: this is not an error, just a stack-trace for debugging purposes):
    at process.on (/home/szymek/.bun/install/global/node_modules/nativescript/lib/nativescript-cli.js:28:28)
    at Object.<anonymous> (/home/szymek/.bun/install/global/node_modules/@ionic/utils-process/dist/index.js:145:13)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/szymek/.bun/install/global/node_modules/@ionic/utils-subprocess/dist/index.js:6:25)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
Migration cache path is: /home/szymek/.local/share/.nativescript-cli/should-migrate-cache-8.8.2.json
Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.
The stackTrace of the location trying to handle SIGINT is (note: this is not an error, just a stack-trace for debugging purposes):
    at process.on (/home/szymek/.bun/install/global/node_modules/nativescript/lib/nativescript-cli.js:28:28)
    at /home/szymek/.bun/install/global/node_modules/signal-exit/index.js:158:17
    at Array.filter (<anonymous>)
    at load (/home/szymek/.bun/install/global/node_modules/signal-exit/index.js:156:23)
    at module.exports (/home/szymek/.bun/install/global/node_modules/signal-exit/index.js:62:7)
    at Object.<anonymous> (/home/szymek/.bun/install/global/node_modules/proper-lockfile/lib/lockfile.js:331:1)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
spawn: /usr/bin/node "/home/szymek/.bun/install/global/node_modules/nativescript/lib/detached-processes/cleanup-process.js" "/home/szymek/.bun/install/global/node_modules/nativescript/lib/bootstrap.js"
(node:19089) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Shasum of file /home/szymek/projects/nativescriptjazda/tamagoczi/package.json is 837e859413535462915b4d431c11718ac308fcf3
Got cached result for shouldMigrate for platform: Android: false
Project dir from hooksArgs is: /home/szymek/projects/nativescriptjazda/tamagoczi.
BeforeHookName for command checkEnvironment is before-checkEnvironment
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Starting',
  customDimensions: { cd2: 'Vue.js', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
spawn: /usr/bin/node "/home/szymek/.bun/install/global/node_modules/nativescript/lib/services/analytics/analytics-broker-process.js" "/home/szymek/.bun/install/global/node_modules/nativescript/lib/bootstrap.js"
Error while trying to parseJson  data from /home/szymek/.local/share/.nativescript-cli/doctor-cache.json file. Err is: SyntaxError: Unexpected end of JSON input
getInfos cacheConfig options: { forceCheck: undefined }  current info from cache:  null
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Warnings:WARNING: adb from the Android SDK is not installed or is not configured properly. __WARNING: The Android SDK is not installed or is not configured properly.',
  customDimensions: { cd2: 'Vue.js', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
✖ WARNING: adb from the Android SDK is not installed or is not configured properly.
 For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

✖ WARNING: The Android SDK is not installed or is not configured properly.
 You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements

Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Finished: Is setup correct: false',
  customDimensions: { cd2: 'Vue.js', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Environment Requirements',
  label: 'Non-interactive terminal, unable to execute local builds.',
  customDimensions: { cd2: 'Vue.js', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/setup/linux#setting-up-linux-for-android.
Error: Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/setup/linux#setting-up-linux-for-android.
    at Errors.failWithOptions (/home/szymek/.bun/install/global/node_modules/nativescript/lib/common/errors.js:165:27)
    at Errors.fail (/home/szymek/.bun/install/global/node_modules/nativescript/lib/common/errors.js:137:21)
    at PlatformEnvironmentRequirements.fail (/home/szymek/.bun/install/global/node_modules/nativescript/lib/services/platform-environment-requirements.js:66:22)
    at PlatformEnvironmentRequirements.<anonymous> (/home/szymek/.bun/install/global/node_modules/nativescript/lib/services/platform-environment-requirements.js:57:22)
    at Generator.next (<anonymous>)
    at fulfilled (/home/szymek/.bun/install/global/node_modules/nativescript/lib/services/platform-environment-requirements.js:11:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Environment
OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Shell: /bin/bash
node: 21.7.3
npm: 10.5.0
nativescript: Not Found

# android
java: 17.0.12
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: Not Found
cocoapods: Not Found
python: Not Found
python3: 3.8.10
ruby: Not Found
platforms: Not Found
Dependencies
"dependencies": {
  "@nativescript/core": "~8.7.0",
  "nativescript-vue": "3.0.0-rc.2"
},
"devDependencies": {
  "@nativescript-dom/core-types": "1.0.31",
  "@nativescript-dom/vue-types": "1.0.16",
  "@nativescript/android": "^8.8.6",
  "@nativescript/preview-cli": "^1.0.13",
  "@nativescript/types": "~8.7.0",
  "@nativescript/webpack": "~5.0.0",
  "@types/node": "~17.0.21",
  "typescript": "^5.4.5",
  "vue-tsc": "2.1.10"
}
Please accept these terms

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ns doctor androidns run android で使用される NativeScript CLI のエントリポイントを追跡し、adbemulator をどのように見つけて呼び出しているかに注目します。上記で説明されている Windows Android SDK の構成を使用して、WSL2 で失敗を再現します。両方のコマンドが symlink を必要とせずに Windows の実行ファイル名を認識できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, javascript
領域
cli, mobile
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。