typescript1.8sharepoint-addin

Failed to instantiate file "app.module.ts" from module "RootModule"


I have sharepoint add-in project, I have inculuded necessary angular2 packages and ts files as you see ss of solution explorer in below:

enter image description here

and here is my ts file contents; boot.ts

import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
bootstrap(AppComponent)

app.component.ts

import {Welcome} from './app.module';
import {Component} from 'angular2/core';
@Component({
    selector: 'app-main',
    template:'<h1>${Welcome.getMessage()}</h1>'
})
export class AppComponent {}

app.module.ts

export class Welcome {
    static getMessage() {
        return "Hello World!";
    }
}

when I run this application I always get this error message in output window:

> @"Error 1
>         CorrelationId: ae2bcaba-cdac-4178-bd39-2aca278a2e31
>         ErrorDetail: There was a problem with activating the app web definition.
>         ErrorType: App
>         ErrorTypeName: App Related
>         ExceptionMessage: Failed to instantiate file "app.module.ts" from module "RootModule": Source path
> "Features\SharePointAddIn4_Feature1\app.module.ts" not found.
>         Source: AppWeb
>         SourceName: App Web Deployment

I have search but cant find any solution helped me.. any idea how to fix this?


Solution

  • To resolve this, I had to set the tsconfig.json file (and others) to not deploy, and remove it from Elements.xml in the root of the project.

    enter image description here

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="RootModule">
      </Module>
    </Elements>