我正在尝试使用本机脚本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的模拟器上运行时,我得到了同样的错误 .

----更新-----

所以我用命令创建了一个空白的角度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"
  }
}