NativeScript 应用不会 运行 IOS
NativeScript app won't run on IOS
我正在评估 nativescript,但我无法让它在 IOS 上运行。尽管 运行 在 Android device/emulator 上(来自 mac),一切都很好。
我根据tutorial on the nativescript site, and tried again with a fresh checkout of 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
查看完整的 --log trace
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'.
如有任何帮助,我们将不胜感激!
谢谢,
罗布
我认为你应该尝试使用 6 以下的 Node 版本,
Nativescript 手动设置提及 "The latest Node.js 0.10.x, 0.12.x, 4.x or 5.x stable official release"
您可以通过NVM(节点版本管理)设置您想要使用的节点版本
希望这能解决您的问题。
我猜这是你的 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,我之前 运行 遇到过这种错误,不得不重新安装。
感谢@Kansen 和@tj-vantoll!
我用这两种方法都解决了。首先通过 NVM (6.5.0) 安装 node,因为作为非 root 用户我不得不使用 sudo 全局安装 nativescript,在安装过程中有一些权限错误,如 "root has no permission to write in /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
我正在评估 nativescript,但我无法让它在 IOS 上运行。尽管 运行 在 Android device/emulator 上(来自 mac),一切都很好。
我根据tutorial on the nativescript site, and tried again with a fresh checkout of 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
查看完整的 --log trace
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'.
如有任何帮助,我们将不胜感激!
谢谢, 罗布
我认为你应该尝试使用 6 以下的 Node 版本,
Nativescript 手动设置提及 "The latest Node.js 0.10.x, 0.12.x, 4.x or 5.x stable official release"
您可以通过NVM(节点版本管理)设置您想要使用的节点版本
希望这能解决您的问题。
我猜这是你的 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,我之前 运行 遇到过这种错误,不得不重新安装。
感谢@Kansen 和@tj-vantoll!
我用这两种方法都解决了。首先通过 NVM (6.5.0) 安装 node,因为作为非 root 用户我不得不使用 sudo 全局安装 nativescript,在安装过程中有一些权限错误,如 "root has no permission to write in /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