Nativescript-angular: JS ERROR ReferenceError: Can't find variable: __decorate

Created on 22 Aug 2016  路  1Comment  路  Source: NativeScript/nativescript-angular

Followed the groceries tutorial and on Chapter 3, on the router section when I try to run the app it will crash.

Crash log:

** BUILD SUCCEEDED **

Project successfully built
Successfully deployed on device with identifier 'CC8A16F5-4ACE-4B02-BB49-DED30BF532FB'.
Aug 22 12:00:27 MacBook-Pro insic[18223]: 1   0x10767bc67 -[TNSRuntime executeModule:]
Aug 22 12:00:27 MacBook-Pro insic[18223]: 2   0x1072ae702 main
Aug 22 12:00:27 MacBook-Pro insic[18223]: 3   0x10b00892d start
Aug 22 12:00:27 MacBook-Pro insic[18223]: file:///app/tns_modules/nativescript-angular/file-system/ns-file-system.js:11:30: JS ERROR ReferenceError: Can't find variable: __decorate
Aug 22 12:00:27 MacBook-Pro com.apple.CoreSimulator.SimDevice.CC8A16F5-4ACE-4B02-BB49-DED30BF532FB.launchd_sim[1545] (UIKitApplication:org.nativescript.groceries[0x7a52][18223]): Service exited due to signal: Segmentation fault: 11

Note the error JS ERROR ReferenceError: Can't find variable: __decorate

Here is my package.json:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.groceries",
    "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": "next",
    "reflect-metadata": "^0.1.5",
    "tns-core-modules": "2.2.0"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "^0.3.2",
    "typescript": "^1.8.10"
  }
}

main.ts

import "reflect-metadata";
import {NS_HTTP_PROVIDERS} from "nativescript-angular/http";
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {AppComponent} from "./app.component";
import {APP_ROUTER_PROVIDERS} from "./app.routes";

nativeScriptBootstrap(AppComponent, [NS_HTTP_PROVIDERS, APP_ROUTER_PROVIDERS]);

app.component.ts

import {Component} from "@angular/core";
import {NS_ROUTER_DIRECTIVES} from "nativescript-angular/router";

@Component({
    selector: "main",
    directives: [NS_ROUTER_DIRECTIVES],
    template: "<page-router-outlet></page-router-outlet>"
})
export class AppComponent {}

Any help to point the issue are really appreciated.

Most helpful comment

Hi, insic.
I had the same problem. I fixed with this: In file main.ts, I put the line

import {nativeScriptBootstrap} from "nativescript-angular/application";
the first one, and everything working again ;D

>All comments

Hi, insic.
I had the same problem. I fixed with this: In file main.ts, I put the line

import {nativeScriptBootstrap} from "nativescript-angular/application";
the first one, and everything working again ;D

Was this page helpful?
0 / 5 - 0 ratings