Compilation error with new version 2.0.1 of UI PRO

Thread is closed for posting
2 posts, 1 answers
  1. Nicola
    Nicola avatar
    13 posts
    Member since:
    Mar 2017

    Posted 09 May 2017 Link to this post

    I'm trying to upgrade my project to the latest UI pro. and I'm getting the following error, Any suggestion on how to address?

    Executing before-prepare hook from /Users/nicola/Development/inkapp/hooks/before-prepare/nativescript-dev-typescript.js
    Found peer TypeScript 2.1.6
    node_modules/nativescript-telerik-ui-pro/calendar/index.d.ts(1,42): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/ui/core/view.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/calendar/index.d.ts(2,27): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/data/observable/observable.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/calendar/index.d.ts(3,23): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/color/color.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/dataform/index.d.ts(1,42): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/ui/core/view.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/dataform/index.d.ts(2,29): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/data/observable/observable.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/listview/index.d.ts(1,42): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/ui/core/view.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/listview/index.d.ts(2,35): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/data/observable/observable.d.ts' is not a module.
    node_modules/nativescript-telerik-ui-pro/listview/index.d.ts(3,40): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/data/observable-array/observable-array.d.ts' is not a module.
     
    node_modules/nativescript-telerik-ui-pro/listview/index.d.ts(4,36): error TS2306: File '/Users/nicola/Development/inkapp/node_modules/tns-core-modules/ui/layouts/stack-layout/stack-layout.d.ts' is not a module.
     
    TypeScript compiler failed with exit code 1
  2. Answer
    Nikolay Iliev
    Admin
    Nikolay Iliev avatar
    351 posts

    Posted 09 May 2017 Link to this post

    Hi Nicola Onassis,

    To upgrade your project to the latest version of NativeScript UI Pro you will also need to update the NativeScript related dependencies to ones compatible with version 3.0.0 (NativeScript). For example, you will need to update nativescript-angular and the @angular dependencies (if your Angular based project).

    In your case, you will need to update the TypeScript dependencies as NativeScript 3.x.x is working with TypeScriot 2.2.x and above.So we will update the typescript and nativescript-dev-typescript to the latest versions.

    The easiest way to upgrade the devDependencies and the dependencies to the right compatible versions is to create a brand new project (e.g with. tns create testApp --ng) and reuse the versioning of the dependencies in the package.json.
    For your convenience here is what the package.json of newly create Angular project looks like at this very moment:
    {
      "description": "NativeScript Application",
      "license": "SEE LICENSE IN <your-license-filename>",
      "readme": "NativeScript Application",
      "repository": "<fill-your-repository-here>",
      "nativescript": {
        "id": "org.nativescript.testAppNg"
      },
      "dependencies": {
        "@angular/animations": "~4.1.0",
        "@angular/common": "~4.1.0",
        "@angular/compiler": "~4.1.0",
        "@angular/core": "~4.1.0",
        "@angular/forms": "~4.1.0",
        "@angular/http": "~4.1.0",
        "@angular/platform-browser": "~4.1.0",
        "@angular/router": "~4.1.0",
        "nativescript-angular": "~3.0.0",
        "nativescript-theme-core": "~1.0.2",
        "reflect-metadata": "~0.1.8",
        "rxjs": "~5.3.0",
        "tns-core-modules": "~3.0.0",
        "zone.js": "~0.8.2"
      },
      "devDependencies": {
        "nativescript-dev-typescript": "~0.4.0",
        "typescript": "^2.3.2"
      }
    }

    Notice the version of TypeScript (2.3.2) and nativescript-dev-typescript(0.4.0). 
    Update versions in your project's package.json file, remove node_modules and platforms folders and rebuild the project and the TypeScript errors should be resolved.

    Regards,
    Nikolay Iliev
    Telerik by Progress
    Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
Back to Top