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

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book