cannot find module 'angular2/core'

cannot find module 'angular2/core'




In Visual Studio 2013, the configurations of typescript is little bit challenging but you can configure typescript manually easily.


Following steps as given below.

Step 1

In the Step1, right-click on your project and Unload Project.

Step 2

In the Step 2, right-click the unloaded project and edit to .csproj file.


Step 3

In the Step 3, add a PropertyGroup node in under the project node which is given below.
  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TYPESCRIPTTARGET>ES5</TYPESCRIPTTARGET>
    <TYPESCRIPTJSXEMIT>NONE</TYPESCRIPTJSXEMIT>
    <TYPESCRIPTCOMPILEONSAVEENABLED>TRUE</TYPESCRIPTCOMPILEONSAVEENABLED>
    <TYPESCRIPTNOIMPLICITANY>FALSE</TYPESCRIPTNOIMPLICITANY>
    <TYPESCRIPTMODULEKIND>COMMONJS</TYPESCRIPTMODULEKIND>
    <TYPESCRIPTREMOVECOMMENTS>FALSE</TYPESCRIPTREMOVECOMMENTS>
    <TYPESCRIPTOUTFILE />
    <TYPESCRIPTOUTDIR />
    <TYPESCRIPTGENERATESDECLARATIONS>FALSE</TYPESCRIPTGENERATESDECLARATIONS>
    <TYPESCRIPTNOEMITONERROR>TRUE</TYPESCRIPTNOEMITONERROR>
    <TYPESCRIPTSOURCEMAP>TRUE</TYPESCRIPTSOURCEMAP>
    <TYPESCRIPTMAPROOT />
    <TYPESCRIPTSOURCEROOT />
    <TYPESCRIPTEXPERIMENTALDECORATORS>TRUE</TYPESCRIPTEXPERIMENTALDECORATORS>
  </PROPERTYGROUP>

     OR

  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>System</TypeScriptModuleKind>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptModuleResolution>NodeJs</TypeScriptModuleResolution>
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
    <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata>
    <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
  </PropertyGroup>

Step 4

In Step 4, right-click on unloaded project and reload to unload project.

Step 5

In Step 5, re-build your project now.

Notes :  

If you still facing same error, restart you visual studio web project.

If you are using Visual Studio 2015, you don't need to edit ".csproject" file, you could directly change in "tsconfig.json"(typescript configuration) file by adding "emitDecoratorMetadata: true".


I think, I might help you!

            
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.