找不到模块'angular2 /核心“ [英] cannot find module 'angular2/core'
问题描述
这些红色波浪线说找不到模块'angular2 /核心
,找不到模块'angular2 /路由器
,找不到模块'angular2 / HTTP
。
我检查了其他职位的<一个href=\"http://stackoverflow.com/questions/34312869/cannot-find-module-angular2-core-in-visual-studio-2015-update-1\">SO但似乎他们没有合适的答案。
These red squiggly lines say cannot find module 'angular2/core'
,cannot find module 'angular2/router'
,cannot find module 'angular2/http'
.
I checked other posts in SO but it seems they have no appropriate answer.
我也加入到 d.ts
文件的引用,如下图所示,但仍然没有工作。
I also added a reference to the d.ts
files as seen below but still not working.
其他的帖子说,我需要配置在 tsconfig.json
文件的东西,但我使用Visual Studio和我认为没有必要使用由角建议tscompiler球队,因为Visual Studio中应能自动编译TS文件。
Other posts say that I need to configure something in the tsconfig.json
file but I am using Visual Studio and I see no need to use the tscompiler suggested by the angular team because Visual Studio should be able to compile ts files automatically.
我缺少的东西吗?
是 tsconfig.json
仍然需要,即使你使用Visual Studio?
Is the tsconfig.json
still required even if you use Visual Studio?
我要如何摆脱这些弯弯曲曲的线?
谢谢!
(我使用Visual Studio 2015年和最新打字稿引擎)
(I am using Visual Studio 2015 and latest Typescript engine)
更新:
我不知道究竟是故宫包管理器。但我有创建项目时创建一个pre-建的package.json
文件。我使用这个文件来安装NPM包。
UPDATE:
I am not sure what exactly is the npm package manager. But I have a pre-built package.json
file that was created when the project was created. I use this file for installing npm packages.
推荐答案
有关在2015年VS ASP.NET 5.0应用程序,配置打字稿是有点挑战性。
For ASP.NET 5.0 applications in VS 2015, configuring typescript is a bit challenging.
直到大约打字稿工装的改进,您可以手动配置打字稿:
Until the tooling around typescript improves, you can configure typescript manually:
Step 1: Right-click project, and Unload Project
Step 2: Right-click the unloaded project, and Edit the .xproj file
Step 3: Add a PropertyGroup node, under the Project node:
<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>
Step 4: Right-click the unloaded project and Reload Project
Step 5: Re-build project
如果您仍然遇到错误的位置无法找到该模块,退出Visual Studio并重新加载的解决方案。
If you are still encountering the error where it cannot find the module, exit visual studio and reload the solution.
这篇关于找不到模块'angular2 /核心“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!