1

我正在评估 nativescript,但我无法让它在 IOS 上运行。不过,在 Android 设备/模拟器上运行时(来自 Mac),这一切都运行良好。

我根据 nativescript 网站上的教程设置了所有内容,并再次尝试重新检出angular2-seed-advanced

  • IOS 模拟器上运行时,应用程序会启动,但不会越过启动屏幕(杂货店显示自己的徽标,播种 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 设备(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
    

    查看完整的 --log 跟踪

    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'.
    

对此的任何帮助将不胜感激!

谢谢,罗伯

4

3 回答 3

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 节点实例中,因此可以省略缓存清理和删除,而且不需要 sudo,因为该实例安装在 ~/.nvm/... 中)

npm i -g nativescript
于 2016-08-31T22:27:58.073 回答
1

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

Nativescript Manual Setup 提到“最新的 Node.js 0.10.x, 0.12.x, 4.x or 5.x stable 正式版”

您可以设置要与NVM一起使用的节点版本(节点版本管理)

我希望这能解决您的问题。

于 2016-08-30T14:12:59.907 回答
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,我之前遇到过这种错误,不得不重新安装。

于 2016-08-31T12:38:58.760 回答