NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 196 forks source link

tns debug ios doesn't work, stuck #2238

Closed af-fess closed 7 years ago

af-fess commented 7 years ago

I run tns debug ios, it builds ios project successfully, opens simulator, opens NativeScript Inspector, print out:

...
Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --timestamp=none /Users/maxim/Appsflyer/projects/nativescript-plugin-appsflyer/demoNative/platforms/ios/build/emulator/demoNative.app

** BUILD SUCCEEDED **

Project successfully built.
Starting iOS Simulator

Setting up proxy...
Press Ctrl + C to terminate, or disconnect.

Frontend client connected.

tns --version => 2.3.0

Screen Shot 2016-11-19 at 12.43.14 PM.png

[EDIT]

BTW for Android I have the same issue, the command tns debug android opens the debugger on http://127.0.0.1:8080/debug?port=40000 but its also empty. I don't see nor warnings neither errors.

KristinaKoeva commented 7 years ago

Hello,

Would you please see if you have any hanging node processes and kill them. A hanging node process may block the communication between the simulator and {N} CLI. If your problem still occurs you can execute tns debug ios --log trace and share the generated log with us so that we could examine it.

af-fess commented 7 years ago

I use last version: tns --version => 2.4.0.

ps -ef | grep node
    0    89     1   0 Thu09AM ??         2:01.76 /System/Library/CoreServices/ionodecache -k /var/db/ionodecache.json
  501  7343   465   0 12:46PM ttys002    0:00.00 grep node

So I don't have node processes

tns debug ios --log trace gives me:

execFile: /Users/maxim/Library/Android/sdk/platform-tools/adb "help"
execFile: /Users/maxim/Library/Android/sdk/platform-tools/adb "help"
spawn: /Users/maxim/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: BufferList { head: null, tail: null, length: 0 },
     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 Maxims-MacBook-Pro.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64

 stderr: 
Exec npm -v 
 stdout: 3.10.3

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

Exec xcodebuild -version 
 stdout: Xcode 8.1
Build version 8B62

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

 stderr: 
Exec pod --version 
 stdout: 1.1.1

 stderr: 
Exec '/Users/maxim/Library/Android/sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.36
Revision e02fe72a18c3-android

 stderr: 
spawn: /Users/maxim/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:  
 stderr: /bin/sh: mono: command not found

Exec git --version 
 stdout: git version 2.9.3 (Apple Git-75)

 stderr: 
Exec gradle -v 
 stdout: 
------------------------------------------------------------
Gradle 3.1
------------------------------------------------------------

Build time:   2016-09-19 10:53:53 UTC
Revision:     13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_101 (Oracle Corporation 25.101-b13)
OS:           Mac OS X 10.12.1 x86_64

 stderr: 
Exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javac" -version 
 stdout:  
 stderr: javac 1.8.0_101

System information:
{ procInfo: 'nativescript/2.4.0',
  platform: 'darwin',
  os: 'Darwin Maxims-MacBook-Pro.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v6.6.0',
  npmVer: '3.10.3',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.1\nBuild version 8B62\n',
  xcodeprojGemLocation: '/Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.4.0/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.1.1',
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: null,
  gitVer: '2.9.3 (Apple Git-75)',
  gradleVer: '3.1',
  javacVersion: '1.8.0_101' }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'debug'.
AnalyticsInstallationID: 5563bf9e-aeb8-4cf0-b161-d53a60184598
monitor not started
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'NodeJSVersion' with value '6_6_0'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Looking for project in '/Users/maxim/Appsflyer/projects/nativescript-plugin-appsflyer/demoNative'
Project directory is '/Users/maxim/Appsflyer/projects/nativescript-plugin-appsflyer/demoNative'.
startLookingForDevices; platform is iOS
Exec ps cax | grep launchd_sim 
 stdout:  5974   ??  S      0:01.55 launchd_sim

 stderr: 
Found device with identifier '73DE4DE7-EA48-4AB0-AE31-B192FF74F456'
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'debug|ios'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Starting iOS Simulator
spawn: /usr/local/bin/node "/usr/local/lib/node_modules/nativescript/node_modules/ios-sim-portable/lib/ios-sim.js" "launch" "/Users/maxim/Appsflyer/projects/nativescript-plugin-appsflyer/demoNative/platforms/ios/build/emulator/demoNative.app" "com.appsflyer.nativescript.demoNative" "--logging" "--args=--nativescript-debug-start" "--waitForDebugger"

Setting up proxy...
Press Ctrl + C to terminate, or disconnect.

Using version 2.4.0. 
Shasum of file /Users/maxim/.npm/tns-ios-inspector/2.4.0/package.tgz is c4bea363721f61f0a5dbb33fad5a002a47ab05d2
Checking shasum of package tns-ios-inspector@2.4.0: expected c4bea363721f61f0a5dbb33fad5a002a47ab05d2, actual c4bea363721f61f0a5dbb33fad5a002a47ab05d2.
Exec open -a '/Users/maxim/.npm/tns-ios-inspector/2.4.0/package/NativeScript Inspector.app' --args '/Users/maxim/.npm/tns-ios-inspector/2.4.0/package/WebInspectorUI/Main.html' 'demoNative' '/var/folders/ms/ls1sh5ms47v4m_z825k2f1q40000gn/T/1161022-7441-1bhdy2l.7ml3rqkt9.sock' 
 stdout:  
 stderr: 
Frontend client connected.

Still the same behaviour

ps -ef | grep node
    0    89     1   0 Thu09AM ??         2:01.81 /System/Library/CoreServices/ionodecache -k /var/db/ionodecache.json
  501  7770   443   0 12:50PM ttys001    0:03.22 node /usr/local/bin/tns debug ios
  501  7787  7770   0 12:50PM ttys001    0:00.46 /usr/local/bin/node /usr/local/lib/node_modules/nativescript/node_modules/ios-sim-portable/lib/ios-sim.js launch /Users/maxim/Appsflyer/projects/nativescript-plugin-appsflyer/demoNative/platforms/ios/build/emulator/demoNative.app com.appsflyer.nativescript.demoNative --logging --args=--nativescript-debug-start --waitForDebugger
  501  7936   465   0 12:51PM ttys002    0:00.00 grep node
KristinaKoeva commented 7 years ago

Hey,

We use lldb to attach to an already running application and we send specific commands to it that enable the debugging experience. The behavior that you are observing makes me think that lldb is not attached properly to your application. This usually happens when there is some lldb dependencies that are missing from your machine. Would you try the following

  1. Start your application with tns run ios --emulator
  2. Find the process id of the running application
  3. Execute the following in your terminal lldb -p process_id (where process_id is the process id of your application) and share the output with us
af-fess commented 7 years ago

$ ps -ef | grep node
    0    89     1   0 Thu09AM ??         2:16.78 /System/Library/CoreServices/ionodecache -k /var/db/ionodecache.json
  501 14160   443   0  2:07PM ttys001    0:06.00 node /usr/local/bin/tns device log --device 2
  501 36990   465   0  6:30PM ttys002    0:03.47 node /usr/local/bin/tns run ios --emulator
  501 37145   492   0  6:31PM ttys003    0:00.00 grep node

$ lldb -p 36990
(lldb) process attach --pid 36990
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
    import six
ImportError: No module named six
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined

....

  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Process 36990 stopped
* thread #1: tid = 0x4668d2, 0x00007fffadabee2e libsystem_kernel.dylib`kevent + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fffadabee2e libsystem_kernel.dylib`kevent + 10
libsystem_kernel.dylib`kevent:
->  0x7fffadabee2e <+10>: jae    0x7fffadabee38            ; <+20>
    0x7fffadabee30 <+12>: movq   %rax, %rdi
    0x7fffadabee33 <+15>: jmp    0x7fffadab6d6f            ; cerror_nocancel
    0x7fffadabee38 <+20>: retq   

Executable module set to "/usr/local/bin/node".
Architecture set to: x86_64h-apple-macosx.
(lldb) 
KristinaKoeva commented 7 years ago

Hey,

It seems that you are missing the six python package. To install it execute pip install six. If you don't have pip installed on your machine take a look at this installation guide.

af-fess commented 7 years ago

Yes, that did the job:

$ pip install six
Collecting six
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.10.0
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

$ pip install --upgrade pip
Successfully uninstalled pip-8.1.2
Successfully installed pip-9.0.1

Thank you for quick response