我正在尝试让 Native Script + Angular2 模板在 ios 模拟器中运行,但我不断收到 SegFault 错误。我从今天开始就对这个平台很陌生,所以这可能是一些初学者的错误。
这是我的错误:
Successfully deployed on device with identifier 'F569EBB0-7559-45C5-BE3E-B07A0144F409'.
1 0x100c00c67 -[TNSRuntime executeModule:]
2 0x100833702 main
3 0x10458d92d start
undefined: JS ERROR Error: Could not find module './'. Computed path '/Users/MYUSERNAME/Library/Developer/CoreSimulator/Devices/F569EBB0-7559-45C5-BE3E-B07A0144F409/data/Containers/Bundle/Application/1A1D0ABB-8B06-4D20-9E99-72153428ED9F/template.app/app'.
com.apple.CoreSimulator.SimDevice.F569EBB0-7559-45C5-BE3E-B07A0144F409.launchd_sim[68428] (UIKitApplication:org.nativescript.helloworldng[0x7fa8][70509]): Service exited due to signal: Segmentation fault: 11
为此,我按照说明安装了 Angular2 和 NativeScript。花了一段时间,但最终所有的tns医生错误都得到了解决。
然后我从 NativeScript 的 git 中得到了 helloworld 应用程序。 https://github.com/NativeScript/template-hello-world-ng.git并做到了npm install
我第一次运行它时,它说它缺少 tns-core-modules,所以我将它添加到依赖项中并再次运行它以得到上面的错误。
这是我的包文件:
{
"private": true,
"nativescript": {
"id": "org.nativescript.helloworldng",
"tns-ios": {
"version": "2.2.1"
}
},
"name": "tns-template-hello-world-ng",
"main": "main.js",
"version": "2.4.1",
"author": "Telerik <support@telerik.com>",
"description": "Nativescript Angular Hello World template",
"license": "BSD",
"keywords": [
"telerik",
"mobile",
"angular",
"nativescript",
"{N}",
"tns",
"appbuilder",
"template"
],
"repository": {
"type": "git",
"url": "git://github.com/NativeScript/template-hello-world-ng"
},
"homepage": "https://github.com/NativeScript/template-hello-world-ng",
"android": {
"v8Flags": "--expose_gc"
},
"dependencies": {
"nativescript-angular": "^0.5.0",
"@angular/core": "2.0.0-rc.6",
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/platform-server": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17",
"tns-core-modules": "2.2.1", // I Added this one
"reflect-metadata": "^0.1.8"
},
"devDependencies": {
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^1.8.10"
}
}
如果我不得不猜测,我可能在某个地方遇到了版本问题,但我对这个平台的了解还不够,无法弄清楚如何解决任何问题。有任何想法吗?
如果您需要更多信息,请告诉我。当我尝试在 android 的模拟器上运行时,我也遇到了同样的错误。
- - 更新 - - -
所以我使用该命令创建了一个空白的 Angular NativeScript 应用程序。它也是错误的,但有不同的错误。我猜这些都是同一个问题的症状。
错误:
Successfully deployed on device with identifier 'F569EBB0-7559-45C5-BE3E-B07A0144F409'.
SecTaskCopyDebugDescription: blank[71086]
SecTaskCopyDebugDescription: blank[71086]
SecTaskCopyDebugDescription: blank[71086]
SecTaskCopyDebugDescription: blank[71086]
SecTaskCopyDebugDescription: blank[71086]
assertion failed: 15A284 13E230: libxpc.dylib + 57882 [66C28065-C9DB-3C8E-926F-5A40210A6D1B]: 0x7d
Sep 11 16:08:53 --- last message repeated 1 time ---
CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: EXCEPTION: RangeError: Maximum call stack size exceeded.
CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: STACKTRACE:
CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: resolvePromise@file:///app/tns_modules/zone.js/dist/zone-node.js:425:42
ZoneAwarePromise@file:///app/tns_modules/zone.js/dist/zone-node.js:470:31
then@file:///app/tns_modules/zone.js/dist/zone-node.js:548:40
then@file:///app/tns_modules/zone.js/dist/zone-node.js:550:20
then@file:///app/tns_modules/zone.js/dist/zone-node.js:550:20
然后它重复最后一行很多次。
这是我的空白应用程序包:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.blank",
"tns-ios": {
"version": "2.2.1"
}
},
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/platform-server": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.2",
"@angular/router-deprecated": "2.0.0-rc.2",
"nativescript-angular": "^0.3.0",
"reflect-metadata": "^0.1.5",
"rxjs": "5.0.0-beta.6",
"timers": "^0.1.1",
"tns-core-modules": "2.2.1",
"zone.js": "^0.6.12"
},
"devDependencies": {
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^1.8.10"
}
}