NativeScript Setup Failed

不打扰是莪最后的温柔 提交于 2021-02-08 05:54:30

问题


I run this command in my Terminal:

tns doctor --log trace

And I get this result:

execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
spawn: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "--help"
Socket {
  _connecting: false,
  _hadError: false,
  _handle: 
   Pipe {
     bytesRead: 0,
     _externalStream: {},
     fd: 15,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: 
   { end: { [Function: g] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState: 
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  _bytesDispatched: 0,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec uname -a 
 stdout: Darwin Muhammads-MacBook-Pro-3.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64

 stderr: 
Exec npm -v 
 stdout: 3.6.0

 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 7.3.1
Build version 7D1014

 stderr: 
Exec gem which xcodeproj 
 stdout: /Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.24.2/lib/xcodeproj.rb

 stderr: 
Exec pod --version 
 stdout:  
 stderr: /bin/sh: pod: command not found

Exec '/Users/iyasilias/Library/Android/sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.36
Revision 8f855a3d9b35-android

 stderr: 
spawn: /Users/iyasilias/Library/Android/sdk/tools/android "-h"
Result when throw error is false:
{ stdout: '\n       Usage:\n       android [global options] action [action options]\n       Global options:\n  -s --silent     : Silent mode, shows errors only.\n  -v --verbose    : Verbose mode, shows errors, warnings and all messages.\n     --clear-cache: Clear the SDK Manager repository manifest cache.\n  -h --help       : Help on a specific command.\n\n                                                                    Valid\n                                                                    actions\n                                                                    are\n                                                                    composed\n                                                                    of a verb\n                                                                    and an\n                                                                    optional\n                                                                    direct\n                                                                    object:\n-    sdk              : Displays the SDK Manager window.\n-    avd              : Displays the AVD Manager window.\n-   list              : Lists existing targets or virtual devices.\n-   list avd          : Lists existing Android Virtual Devices.\n-   list target       : Lists existing targets.\n-   list device       : Lists existing devices.\n-   list sdk          : Lists remote SDK repository.\n- create avd          : Creates a new Android Virtual Device.\n-   move avd          : Moves or renames an Android Virtual Device.\n- delete avd          : Deletes an Android Virtual Device.\n- update avd          : Updates an Android Virtual Device to match the folders\n                        of a new SDK.\n- create project      : Creates a new Android project.\n- update project      : Updates an Android project (must already have an\n                        AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n                        already have an AndroidManifest.xml).\n- create lib-project  : Creates a new Android library project.\n- update lib-project  : Updates an Android library project (must already have\n                        an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb          : Updates adb to support the USB devices declared in the\n                        SDK add-ons.\n- update sdk          : Updates the SDK by suggesting new platforms to install\n                        if available.\n',
  stderr: '',
  exitCode: 1 }
Exec mono --version 
 stdout: Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Fri Nov  6 12:25:19 EST 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          yes(3.6.0svn-mono-(detached/a173357)
    GC:            sgen

 stderr: 
Exec git --version 
 stdout: git version 2.6.4

 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Exec "javac" -version 
 stdout:  
 stderr: javac 1.8.0_102

System information:
{ procInfo: 'nativescript/2.2.1',
  platform: 'darwin',
  os: 'Darwin Muhammads-MacBook-Pro-3.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v4.5.0',
  npmVer: '3.6.0',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.24.2/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: null,
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: '4.2.1',
  gitVer: '2.6.4',
  gradleVer: null,
  javacVersion: '1.8.0_102' }
Looking for project in '/Users/iyasilias'
Looking for project in '/Users'
Looking for project in '/'
No project found at or above '/Users/iyasilias'.
No project found at or above '%s' and neither was a --path specified.
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'doctor'.
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
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.
Exec pod --version 
 stdout:  
 stderr: /bin/sh: pod: command not found

Exec xcodebuild -version 
 stdout: Xcode 7.3.1
Build version 7D1014

 stderr: 
spawn: /Users/iyasilias/Library/Android/sdk/tools/android "list" "targets"
Result when throw error is false:
{ stdout: 'Available Android targets:\n----------\nid: 1 or "android-13"\n     Name: Android 3.2\n     Type: Platform\n     API level: 13\n     Revision: 1\n     Skins: WXGA (default)\n Tag/ABIs : default/armeabi\n----------\nid: 2 or "android-14"\n     Name: Android 4.0\n     Type: Platform\n     API level: 14\n     Revision: 4\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800\n Tag/ABIs : no ABIs.\n----------\nid: 3 or "android-15"\n     Name: Android 4.0.3\n     Type: Platform\n     API level: 15\n     Revision: 5\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800\n Tag/ABIs : no ABIs.\n----------\nid: 4 or "android-16"\n     Name: Android 4.1.2\n     Type: Platform\n     API level: 16\n     Revision: 5\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 5 or "android-17"\n     Name: Android 4.2.2\n     Type: Platform\n     API level: 17\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 6 or "android-18"\n     Name: Android 4.3.1\n     Type: Platform\n     API level: 18\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 7 or "android-19"\n     Name: Android 4.4.2\n     Type: Platform\n     API level: 19\n     Revision: 4\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 8 or "android-20"\n     Name: Android 4.4W.2\n     Type: Platform\n     API level: 20\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 9 or "android-21"\n     Name: Android 5.0.1\n     Type: Platform\n     API level: 21\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 10 or "android-22"\n     Name: Android 5.1.1\n     Type: Platform\n     API level: 22\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 11 or "android-23"\n     Name: Android 6.0\n     Type: Platform\n     API level: 23\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : no ABIs.\n----------\nid: 12 or "android-24"\n     Name: Android 7.0\n     Type: Platform\n     API level: 24\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320\n Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64\n----------\nid: 13 or "Google Inc.:Google APIs:21"\n     Name: Google APIs\n     Type: Add-On\n     Vendor: Google Inc.\n     Revision: 1\n     Description: Android + Google APIs\n     Based on Android 5.0.1 (API level 21)\n     Libraries:\n      * com.android.future.usb.accessory (usb.jar)\n          API for USB Accessories\n      * com.google.android.media.effects (effects.jar)\n          Collection of video effects\n      * com.google.android.maps (maps.jar)\n          API for Google Maps\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in\n Tag/ABIs : google_apis/x86\n',
  stderr: '',
  exitCode: 0 }
Available Android targets:
----------
id: 1 or "android-13"
     Name: Android 3.2
     Type: Platform
     API level: 13
     Revision: 1
     Skins: WXGA (default)
 Tag/ABIs : default/armeabi
----------
id: 2 or "android-14"
     Name: Android 4.0
     Type: Platform
     API level: 14
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
----------
id: 3 or "android-15"
     Name: Android 4.0.3
     Type: Platform
     API level: 15
     Revision: 5
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 Tag/ABIs : no ABIs.
----------
id: 4 or "android-16"
     Name: Android 4.1.2
     Type: Platform
     API level: 16
     Revision: 5
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 5 or "android-17"
     Name: Android 4.2.2
     Type: Platform
     API level: 17
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 6 or "android-18"
     Name: Android 4.3.1
     Type: Platform
     API level: 18
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 7 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 8 or "android-20"
     Name: Android 4.4W.2
     Type: Platform
     API level: 20
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 9 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 10 or "android-22"
     Name: Android 5.1.1
     Type: Platform
     API level: 22
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 11 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 12 or "android-24"
     Name: Android 7.0
     Type: Platform
     API level: 24
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320
 Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 13 or "Google Inc.:Google APIs:21"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 5.0.1 (API level 21)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : google_apis/x86

Directories found in /Users/iyasilias/Library/Android/sdk/build-tools are 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1
Versions found in /Users/iyasilias/Library/Android/sdk/build-tools are 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1
Selected version is:  23.0.3
Selected targetSdk is: 23
Directories found in /Users/iyasilias/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0-alpha1, 24.0.0-alpha2, 24.0.0-beta1, 24.1.0, 24.1.1, 24.2.0, maven-metadata.xml, maven-metadata.xml.md5, maven-metadata.xml.sha1
Versions found in /Users/iyasilias/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0, 24.0.0, 24.0.0, 24.1.0, 24.1.1, 24.2.0
Selected version is:  23.4.0
Selected AppCompat version is: 23.4.0
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'DoctorEnvironmentSetup' with value 'incorrect'.
There seem to be issues with your configuration.

And if I run the setup script, I can't install xcodeproj and cocoapods

Note: The first $ANDROID_HOME path problem have been solved thanks to Dennis Tang

Please help..


回答1:


Specifically with the $ANDROID_HOME issue, you need to add export ANDROID_HOME=/Users/iyasilias/Library/Android/sdk to your ~/.bash_profile for it to persist through terminal sessions.

Given that you're having issues with abd as well as Cocoapods, I'd recommend running the NativeScript setup again to let it try and install everything correctly: ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)"

EDIT for xcodeproj and cocoapods

You should check out the advanced installation instructions at http://docs.nativescript.org/angular/start/ns-setup-os-x

Specifically, step 1-4 of step 3 (confusing how they've nested a numbered list inside a numbered list), but it's the options of making sure Xcode and Command Line Tools for Xcode are installed.

From there, you can install the gems, though I'd use sudo gem install -n /usr/local/bin xcodeproj cocoapods instead of just normal sudo gem install if you're on OS X El Capitan due to SIP preventing you from installing gems in /usr/bin.

Hopefully after that you should be good to go!




回答2:


This might not solve all of your setup issues, but for the $ANDROID_HOME environment variable, you might want to look at this answer: https://askubuntu.com/a/266760 (note that they use the variable ANDROID_SDK_HOME, make sure that your variable name is ANDROID_HOME!)

Once you set up a .profile file and source .profile as mentioned in that answer and restart your system, $ANDROID_HOME should always point to your path /Users/iyasilias/Library/Android/sdk.

Assuming that you've properly installed the SDK in that folder, tns doctor should detect the Android SDK folder thereafter.




回答3:


NativeScript Setup Failed?

As for $ANDROID_HOME, insert export ANDROID_HOME=/Users/iyasilias/Library/Android/sdk to your ~/.bash_profile as per Dennis Tang suggestion.

As for Cocoapods keep failing to install, as for me it's because the OS I'm using (El Capitan). The solution is to create custom GEM_HOME

$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:$HOME/Software/ruby/bin
$ pod --version

Source: https://github.com/CocoaPods/CocoaPods/issues/3692



来源:https://stackoverflow.com/questions/39363861/nativescript-setup-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!