NativeScript / NativeScript/nativescript-cli

The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.

未关闭
#5,710 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

needs more info
主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

描述

Issue Description

sudo tns run android

✔ The Android SDK is installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.

✖ 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

✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later.
Run $ sdkmanager to manage your Android SDK versions.

✖ No compatible version of the Android SDK Build-tools are installed on your system. You can install any version in the following range: '>=23 <=33'.
Install the required build-tools through Android Studio. In case you already have them installed, make sure the ANDROID_HOME environment variable is set correctly.

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/environment-setup.html#macos-android.

Reproduction

sudo tns run android

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


Trying to get macOS version.
Exec system_profiler SPSoftwareDataType -detailLevel mini 
 stdout: Software:

    System Software Overview:

      System Version: macOS 10.15.7 (19H2026)
      Kernel Version: Darwin 19.6.0
      Time since boot: 1:56

 
 stderr: 
macOS version based on system_profiler is 10.15.
Looking for project in '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course'
Project directory is '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course'.
Initializing project identifiers. Config:  {
  id: 'org.nativescript.nsngcourse',
  appPath: 'src',
  appResourcesPath: 'App_Resources',
  android: { v8Flags: '--expose_gc', markingMode: 'none' }
}
Loading extensions.
Collecting system information...
System information:
{
  "platform": "darwin",
  "shell": "/bin/bash",
  "os": "Darwin Alexandres-Mac.lan 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64\n",
  "procArch": "x64",
  "nodeVer": "16.17.0",
  "npmVer": "9.2.0",
  "nodeGypVer": null,
  "nativeScriptCliVersion": "8.4.0",
  "gitVer": "2.21.0",
  "dotNetVer": null,
  "javacVersion": "11.0.17",
  "javaVersion": "11.0.17",
  "javaPath": "java",
  "adbVer": "1.0.41",
  "androidInstalled": true,
  "monoVer": null,
  "gradleVer": null,
  "isAndroidSdkConfiguredCorrectly": true,
  "xcodeprojLocation": null,
  "itunesInstalled": true,
  "isCocoaPodsWorkingCorrectly": true,
  "isCocoaPodsUpdateRequired": false,
  "pythonInfo": {
    "isInstalled": true,
    "isSixPackageInstalled": true
  }
}
Current CLI version:  8.4.0
Project dir from hooksArgs is: undefined.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
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:
    at process.on (/usr/local/lib/node_modules/nativescript/lib/nativescript-cli.js:26:28)
    at /usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:158:17
    at Array.filter (<anonymous>)
    at load (/usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:156:23)
    at module.exports (/usr/local/lib/node_modules/nativescript/node_modules/signal-exit/index.js:62:7)
    at Object.<anonymous> (/usr/local/lib/node_modules/nativescript/node_modules/proper-lockfile/lib/lockfile.js:331:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
spawn: /usr/local/bin/node "/usr/local/lib/node_modules/nativescript/lib/detached-processes/cleanup-process.js" "/usr/local/lib/node_modules/nativescript/lib/bootstrap.js"
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'pageview',
  path: 'doctor',
  title: 'doctor',
  customDimensions: { cd5: 'CLI', cd2: 'Angular', cd9: 'false' }
}
spawn: /usr/local/bin/node "/usr/local/lib/node_modules/nativescript/lib/services/analytics/analytics-broker-process.js" "/usr/local/lib/node_modules/nativescript/lib/bootstrap.js"
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Options',
  label: '{"log":"trace","$0":"tns","profileDir":"private","bundle":"webpack"}',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
⠋ Getting environment information 
✔ Getting environment information 

There seem to be issues with your configuration.
⠙ Getting NativeScript components versions information...Exec npm view nativescript  dist-tags --json 
 stdout: {
  "latest": "8.4.0",
  "next": "8.4.0-next-12-04-2022-3613799910",
  "beta": "8.3.2"
}
 
 stderr: 
Using version 8.4.0. 
⠹ Getting NativeScript components versions information...Exec npm view tns-core-modules  dist-tags --json 
 stdout: {
  "latest": "6.5.27",
  "tns-next": "6.5.25-tns-next-09-28-2021-1283647697"
}
 
 stderr: 
Using version 6.5.27. 
⠙ Getting NativeScript components versions information...Exec npm view @nativescript/core  dist-tags --json 
 stdout: {
  "latest": "8.4.2",
  "next": "8.4.3-next-12-29-2022-3798656203",
  "tns": "6.5.27",
  "tns-next": "6.5.25-tns-next-09-28-2021-1283647697",
  "alpha": "8.3.0-alpha.2",
  "sap": "8.1.0-sap.0",
  "rc": "8.1.0-rc.0",
  "dom": "8.5.0-dom.2"
}
 
 stderr: 
Using version 8.4.2. 
Could not find an installed runtime, falling back to default runtimes
⠼ Getting NativeScript components versions information...Exec npm view @nativescript/android  dist-tags --json 
 stdout: {
  "rc": "8.2.0-rc.0",
  "latest": "8.4.0",
  "alpha": "8.4.0-alpha.8",
  "dev": "8.4.0-dev.2",
  "beta": "8.5.0-beta.0"
}
 
 stderr: 
Using version 8.4.0. 
⠸ Getting NativeScript components versions information...Exec npm view @nativescript/ios  dist-tags --json 
 stdout: {
  "latest": "8.4.0",
  "JSC": "6.5.6",
  "alpha": "8.4.0-alpha.3",
  "sap": "8.3.0-sap.0",
  "dev": "8.4.0-dev.1",
  "beta": "8.5.0-beta.0"
}
 
 stderr: 
Using version 8.4.0. 
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.4.0 version and is up to date.
✔ Component @nativescript/core has 8.4.2 version and is up to date.
✖ Component @nativescript/ios is not installed.
✔ Component @nativescript/android has 8.4.0 version and is up to date.
Unable to validate if project has short imports. Error is Error: ENOENT: no such file or directory, scandir '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/node_modules/tns-core-modules'
    at Object.readdirSync (node:fs:1442:3)
    at FileSystem.readDirectory (/usr/local/lib/node_modules/nativescript/lib/common/file-system.js:189:19)
    at DoctorService.getShortImportRegExp (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:188:14)
    at DoctorService.getDeprecatedShortImportsInFiles (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:168:40)
    at DoctorService.checkForDeprecatedShortImportsInAppDir (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:154:43)
    at DoctorService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:80:18)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/services/doctor-service.js:11:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/node_modules/tns-core-modules'
}
Project dir from hooksArgs is: /Users/alexandredomingues/Downloads/nativeScript/ns-ng-course.
Hooks directories: [
  '/Users/alexandredomingues/Downloads/nativeScript/ns-ng-course/hooks'
]
BeforeHookName for command checkEnvironment is before-checkEnvironment
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Check Local Build Setup',
  label: 'Starting',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
Error while trying to parseJson  data from /Users/alexandredomingues/.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: Xcode is not installed or is not configured properly.__WARNING: xcodeproj is not installed or is not configured properly.__WARNING: CocoaPods is not installed or is not configured properly.',
  customDimensions: { cd2: 'Angular', cd9: 'false', cd5: 'CLI' },
  value: undefined
}
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ 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.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ WARNING: Xcode is not installed or is not configured properly. 
 You will not be able to build your projects for iOS or run them in the iOS Simulator.
To be able to build for iOS and run apps in the native emulator, verify that you have installed Xcode. 

✖ WARNING: xcodeproj is not installed or is not configured properly. 
 You will not be able to build your projects for iOS.
To be able to build for iOS and run apps in the native emulator, verify that you have installed xcodeproj. 

✖ WARNING: CocoaPods is not installed or is not configured properly. 
 You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods (`sudo gem install cocoapods`). 

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: 'Angular', 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: 'Angular', 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/environment-setup.html.
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/environment-setup.html.
    at Errors.failWithOptions (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:157:27)
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:130:21)
    at PlatformEnvironmentRequirements.fail (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:63:22)
    at PlatformEnvironmentRequirements.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:54:22)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/nativescript/lib/services/platform-environment-requirements.js:11:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Environment

No response

Please accept these terms

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 lib/services/doctor-service.js 中展示的 NativeScript CLI DoctorService 入口点开始,并将 tns run android 的环境检查与 checkEnvironment 进行比较。使用提供的 macOS、CLI、Android SDK 和 ANDROID_HOME 详细信息重现报告中的输出;当这些检查能够一致地反映已配置的 Android 环境,或明确识别出实际故障时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, javascript
领域
cli, mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。