nativescript-cli: Livesync hangs, especially bad on iOS

I’m having multiple issues with livesync, expecially on iOS. I am unsure if they are related, but I will outline what is happening below.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.3.1
  • Cross-platform modules: 3.3.0
  • Runtime(s): tns-android: 3.3.1 tns-ios: 3.3.0
  • Plugin(s):
{
    "nativescript-advanced-webview": "^1.1.3",
    "nativescript-angular": "~4.4.1",
    "nativescript-async": "^1.0.2",
    "nativescript-drop-down": "^3.1.0",
    "nativescript-floatingactionbutton": "^3.0.0",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-gradient": "^2.0.1",
    "nativescript-iqkeyboardmanager": "^1.1.0",
    "nativescript-ng-shadow": "^1.1.2",
    "nativescript-plugin-firebase": "^4.0.6",
    "nativescript-pro-ui": "^3.1.3",
    "nativescript-snackbar": "^2.0.0",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-unit-test-runner": "^0.3.4"
}

Please tell us how to recreate the issue in as much detail as possible.

When I tns run ios, my app will begin to build and then hang. Building a clean build seems to temporarily fix it, but eventually it happens again, often in the middle of my day when I haven’t made any changes to dependencies or anything like that. I have also noticed that when it is hanging I can suspend the app by pressing the home button and it will proceed. I’ve seen mentioned to run with the --log trace output and I will paste the content below.

Loading extensions.
Asserting extension nativescript-angular-cli is installed.
Extension nativescript-angular-cli is installed.
execFile: /Users/vincecooley/Library/Android/sdk/platform-tools/adb "help"
Exec uname -a 
 stdout: Darwin Vinces-MacBook-Pro.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
 
 stderr: 
Exec npm -v 
 stdout: 4.2.0
 
 stderr: 
spawn: java "-version"
Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: node-gyp: command not found

Error while executing node-gyp -v: Command failed: node-gyp -v
/bin/sh: node-gyp: command not found

Exec xcodebuild -version 
 stdout: Xcode 9.0.1
Build version 9A1004
 
 stderr: 
Exec gem which xcodeproj 
 stdout: /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb
 
 stderr: 
Exec pod --version 
 stdout: 1.2.0
 
 stderr: 
Exec '/Users/vincecooley/Library/Android/sdk/platform-tools/adb' version 
 stdout: Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /Users/vincecooley/Library/Android/sdk/platform-tools/adb

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

Error while executing mono --version: Command failed: mono --version
/bin/sh: mono: command not found

Exec git --version 
 stdout: git version 2.13.5 (Apple Git-94)
 
 stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: gradle: command not found

Error while executing gradle -v: Command failed: gradle -v
/bin/sh: gradle: command not found

Exec "/Library/Java/Home/bin/javac" -version 
 stdout:  
 stderr: javac 1.8.0_121

System information:
{ procInfo: 'nativescript/3.3.1',
  platform: 'darwin',
  os: 'Darwin Vinces-MacBook-Pro.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v7.9.0',
  npmVer: '4.2.0',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 9.0.1\nBuild version 9A1004\n',
  xcodeprojGemLocation: '/usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.2.0',
  adbVer: 'Android Debug Bridge version 1.0.39',
  emulatorInstalled: true,
  monoVer: null,
  gitVer: '2.13.5 (Apple Git-94)',
  gradleVer: null,
  javacVersion: '1.8.0_121' }
Looking for project in '/Users/vincecooley/Projects/myproject'
Project directory is '/Users/vincecooley/Projects/myproject'.
Exec which xcodebuild 
 stdout: /usr/bin/xcodebuild
 
 stderr: 
Exec xcodebuild -version | head -n 1 | sed -e 's/Xcode //' 
 stdout: 9.0.1
 
 stderr: 
Validate options for platform: iOS
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
spawn: node "/usr/local/lib/node_modules/nativescript/lib/services/analytics/analytics-broker-process.js" "/usr/local/lib/node_modules/nativescript/lib/bootstrap.js"
Searching for devices...
startLookingForDevices; platform is iOS
Starting to look for iOS devices.
Exec ps cax | grep launchd_sim 
 stdout: 23462   ??  S      0:03.01 launchd_sim
 
 stderr: 
Found device with identifier 'BE9FC449-B049-4FF8-967F-23506BE243A7'
startLookingForDevices; platform is iOS
Exec ps cax | grep launchd_sim 
 stdout: 23462   ??  S      0:03.01 launchd_sim
 
 stderr: 
Exec ps cax | grep launchd_sim 
 stdout: 23462   ??  S      0:03.01 launchd_sim
 
 stderr: 
Project dir from hooksArgs is: /Users/vincecooley/Projects/myproject.
Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
  '/usr/local/lib/node_modules/nativescript/lib/common/hooks',
  '/Users/vincecooley/Projects/myproject/hooks' ]
BeforeHookName for command liveSync is before-liveSync
Executing before-liveSync hook from /Users/vincecooley/Projects/myproject/hooks/before-liveSync/nativescript-angular-sync.js
Executing before-liveSync hook at location /Users/vincecooley/Projects/myproject/hooks/before-liveSync/nativescript-angular-sync.js in-process
Validating before-liveSync arguments.
Changes info in prepare platform: ProjectChangesInfo {
  appFilesChanged: false,
  packageChanged: false,
  appResourcesChanged: false,
  nativeChanged: false,
  configChanged: false,
  nativePlatformStatus: '3' }
Skipping prepare.
Will send the following information to Google Analytics: { googleAnalyticsDataType: 'event',
  action: 'LiveSync',
  label: 'iOS_Simulator_11.0',
  customDimensions: { cd2: 'Angular' } }

At this point, I get a hang and can manually suspend the app to resume. I’d also like to note that if I kill it here I get the following message:

^CUnable to apply changes on device: BE9FC449-B049-4FF8-967F-23506BE243A7. Error is: process.send is not a function.
Project dir from hooksArgs is: /Users/vincecooley/Projects/myproject.
Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
  '/usr/local/lib/node_modules/nativescript/lib/common/hooks',
  '/Users/vincecooley/Projects/myproject/hooks' ]
AfterHookName for command watch is after-watch
Executing after-watch hook from /Users/vincecooley/Projects/myproject/hooks/after-watch/nativescript-dev-typescript.js
Executing after-watch hook at location /Users/vincecooley/Projects/myproject/hooks/after-watch/nativescript-dev-typescript.js in-process
Validating after-watch arguments.
Project dir from hooksArgs is: /Users/vincecooley/Projects/myproject.
Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
  '/usr/local/lib/node_modules/nativescript/lib/common/hooks',
  '/Users/vincecooley/Projects/myproject/hooks' ]
AfterHookName for command liveSync is after-liveSync
IOSDeviceOperations disposed.

Finally, I’m not sure if this is related or not, but I get many incremental compilation messages when I have made no changes. The app does not refresh after receiving these until I have actually made some changes. For example:

9:31:38 AM - File change detected. Starting incremental compilation...

9:31:39 AM - Compilation complete. Watching for file changes.

9:31:44 AM - File change detected. Starting incremental compilation...

9:31:45 AM - Compilation complete. Watching for file changes.

9:31:45 AM - File change detected. Starting incremental compilation...

9:31:46 AM - Compilation complete. Watching for file changes.

etc…

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 28 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @dtopuzov,

Any timeline for fixing this … pretty much have to kill IOS livesync every one or two changes.

Regards, Tarek

Any update on this? I too am getting the same as @EmandM error if I Ctrl+C.

If I don’t kill the process, it occasionally it freezes referencing an error in Immediate.js, which is needed by rxjs. There is a document.createElement(‘script’) reference on line 56. If I comment out or put an if before it, it doesn’t load the updated file, instead the old one before the change.

Otherwise it stays frozen on Skipping Prepare

Hey guys,

I’ve investigated the issue and found that {N} CLI hangs when trying to start the application. It seems that simctl launch command does not launch the process immediately and we have to wait a little bit, just to ensure all related processes and services are alive. I’m trying to fix the problem with above PR.

Hack for iOS11 issue: After clicking on the home button of the simulator (to mimimize the app) changes are synced.