NativeScript应用程序不会在IOS上运行

时间:2016-08-29 22:35:09

标签: ios nativescript angular2-nativescript

我正在评估nativescript,但我无法让它在IOS上工作。虽然(从mac)在Android设备/模拟器上运行,但一切运行良好。

我根据nativescript网站上的tutorial设置了所有内容,然后重新尝试了angular2-seed-advanced

  • IOS-Simulator 上运行时,应用程序会启动,但不要通过启动画面(杂货会显示自己的徽标,播放nativescript徽标)。

    Successfully deployed on device with identifier 'yyyyyyyyyyyyyyyyyyyyy'.
    Aug 30 00:13:35 macmini com.apple.CoreSimulator.SimDevice.yyyyyyyyyyyyyyyyyyyyy.launchd_sim[59384] (UIKitApplication:org.nativescript.groceries[0x9af7][60400]): Service exited due to signal: Killed: 9
    
  • 尝试在 IOS-Device (IPhone 5)上运行时,在尝试部署期间出现了另一个错误(两个项目都相同),因此该应用甚至没有获得部署到设备。似乎在等待物理设备回调时,nativescript(FiberFuture?)的依赖关系没有得到解决(模拟器似乎已经过了这一步)。

    TypeError: Cannot read property 'id' of undefined
    at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
    at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
    

    请参阅此完整的 - 日志跟踪

    macmini:nativescript xxx$ tns run ios --log trace
    execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
    execFile: /usr/local/opt/android-sdk/platform-tools/adb "help"
    spawn: /usr/local/opt/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 macmini 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
    
     stderr: 
    Exec npm -v 
     stdout: 3.10.3
    
     stderr: 
    spawn: java "-version"
    Exec node-gyp -v 
     stdout: v3.4.0
    
     stderr: 
    Exec xcodebuild -version 
     stdout: Xcode 7.3.1
    Build version 7D1014
    
     stderr: 
    Exec gem which xcodeproj 
     stdout: /Users/rob/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb
    
     stderr: 
    Exec pod --version 
     stdout: 1.0.1
    
     stderr: 
    Exec '/usr/local/opt/android-sdk/platform-tools/adb' version 
     stdout: Android Debug Bridge version 1.0.36
    Revision af05c7354fe1-android
    
     stderr: 
    spawn: /usr/local/opt/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.4.1 (Nightly 4.4.1.0/4747417 Tue Jul  5 17:44:19 BST 2016)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
            TLS:           normal
            SIGSEGV:       altstack
            Notification:  kqueue
            Architecture:  amd64
            Disabled:      none
            Misc:          softdebug 
            LLVM:          supported, not enabled.
            GC:            sgen
    
     stderr: 
    Exec git --version 
     stdout: git version 2.7.4 (Apple Git-66)
    
     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 macmini 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64\n',
      shell: '/bin/bash',
      dotNetVer: null,
      procArch: 'x64',
      nodeVer: 'v6.3.1',
      npmVer: '3.10.3',
      javaVer: '1.8.0',
      nodeGypVer: 'v3.4.0\n',
      xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
      xcodeprojGemLocation: '/Users/rob/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/xcodeproj-1.2.0/lib/xcodeproj.rb\n',
      itunesInstalled: true,
      cocoapodVer: '1.0.1',
      adbVer: 'Android Debug Bridge version 1.0.36',
      androidInstalled: true,
      monoVer: '4.4.1',
      gitVer: '2.7.4 (Apple Git-66)',
      gradleVer: null,
      javacVersion: '1.8.0_102' }
    Initializing analytics statuses.
    Analytics statuses: 
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'run'.
    Looking for project in '/Users/xxx/workspace/angular2-seed-advanced/nativescript'
    Project directory is '/Users/xxx/workspace/angular2-seed-advanced/nativescript'.
    Analytics statuses: 
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'run|ios'.
    startLookingForDevices; platform is iOS
    Found device with identifier 'c28457499xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    Exec ps cax | grep launchd_sim 
     stdout: 51449   ??  S      0:01.63 launchd_sim
    
     stderr: 
    TypeError: Cannot read property 'id' of undefined
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:566:15)
        at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:84:106
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/common/yok.js:208:124
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/common/services/commands-service.js:51:55
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/common/errors.js:128:33
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        - - - - -
        at IOSSimulator.Object.defineProperty.get [as deviceInfo] (/usr/local/lib/node_modules/nativescript/lib/common/mobile/ios/simulator/ios-simulator-device.js:15:43)
        at IOSSimulatorDiscovery.DeviceDiscovery.addDevice (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/device-discovery.js:16:28)
        at IOSSimulatorDiscovery.createAndAddDevice (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:58:14)
        at IOSSimulatorDiscovery.checkForDevices (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:27:26)
        at IOSSimulatorDiscovery.startLookingForDevices (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/ios-simulator-discovery.js:20:21)
        at /usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:215:50
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:330:48
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:366:103
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
        at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
        at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:402:58
        at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    Analytics statuses: 
    { TrackFeatureUsage: 1, TrackExceptions: 1 }
    Trying to track feature 'CLI' with value 'help'.
    List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, usage-reporting
    Reading help for command 'run|ios'. FileName is 'run-ios.md'.
    

非常感谢任何帮助!

谢谢, 罗布

3 个答案:

答案 0 :(得分:1)

我认为您应该尝试使用6以下的Node版本,

Nativescript手动设置提及"最新的Node.js 0.10.x,0.12.x,4.x或5.x稳定的正式版本"

您可以使用NVM(节点版本管理)

设置要使用的节点版本

我希望这可以解决您的问题。

答案 1 :(得分:1)

我的猜测是这是你的npm缓存的一个问题。你能试试以下吗?

npm cache clean
npm remove -g nativescript
npm remove -g nativescript (yes twice)
npm install -g nativescript

我的来源是https://github.com/NativeScript/nativescript-cli/issues/1862#issuecomment-227444053,之前我遇到过这种错误,不得不重新安装。

答案 2 :(得分:1)

感谢@Kansen和@ tj-vantoll!

我用两种解决方案解决了这个问题。首先通过NVM(6.5.0)安装节点,因为作为非root用户我必须使用sudo全局安装nativescript,在安装过程中会出现一些权限错误,例如" root无权写入在/ Users / myUser"

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash

nvm install node
nvm use node
# re-open terminal or re-source your bash config e.g.:
source ~/.bashrc

然后执行一个全新的nativescript安装(现在在新的nvm节点实例中,因此可以省略cache clean和remove,加上不需要sudo,因为这个实例安装在〜/ .nvm /...)

npm i -g nativescript
相关问题