'angular2 / core'모듈을 찾을 수 없습니다.
이 빨간색 물결 모양의 선은 말한다 cannot find module 'angular2/core'
, cannot find module 'angular2/router'
, cannot find module 'angular2/http'
. 그래서 다른 게시물을 확인 했지만 적절한 답변이없는 것 같습니다.
또한 d.ts
아래와 같이 파일 에 대한 참조를 추가 했지만 여전히 작동하지 않습니다.
다른 게시물에 따르면 tsconfig.json
파일 에서 무언가를 구성해야 하지만 Visual Studio를 사용하고 있으며 Visual Studio가 ts 파일을 자동으로 컴파일 할 수 있어야하므로 앵귤러 팀에서 제안한 tscompiler를 사용할 필요가 없다고합니다.
내가 뭔가를 놓치고 있습니까?
는 IS tsconfig.json
당신은 비주얼 스튜디오를 사용하는 경우에도 여전히 필요?
이 구불 구불 한 선을 어떻게 제거합니까?
감사!
(Visual Studio 2015 및 최신 Typescript 엔진을 사용하고 있습니다)
업데이트 : npm 패키지 관리자가 정확히 무엇인지 잘 모르겠습니다. 하지만 package.json
프로젝트가 생성 될 때 생성 된 미리 빌드 된 파일이 있습니다. 이 파일을 npm 패키지 설치에 사용합니다.
VS 2015의 ASP.NET 5.0 응용 프로그램의 경우 typescript를 구성하는 것은 약간 어렵습니다.
typescript 관련 도구가 개선 될 때까지 typescript를 수동으로 구성 할 수 있습니다.
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를 종료하고 솔루션을 다시로드합니다.
내 작업 설정은 다음과 같습니다.
<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>
이것을 웹 프로젝트에 적용한 후 Visual Studio를 다시 시작하십시오.
VS2015의 경우 도구-> 옵션-> 텍스트 편집기-> TypeScript-> 프로젝트-> 일반으로 이동 한 다음 "프로젝트의 일부가 아닌 TypeScript 파일 자동 컴파일"을 선택한 다음 "모듈에 CommonJS 코드 생성 사용"을 선택합니다.
이것이 VS2015에서 문제를 해결 한 방법입니다.
- 프로젝트 속성 창을 엽니 다.
- TypeScript 빌드 탭으로 이동합니다.
- 아래 이미지와 같이 CommonJS를 모듈 시스템으로 선택하십시오.
나도이 오류가 발생하여 프로젝트를 언로드하고 .csproj 파일을 확인하는 것이 효과적이었습니다. 이 스 니펫이 추가 된 것을 발견했습니다.
<ItemGroup>
<None Remove="ClientApp\components\componentname\componentname.ts" />
</ItemGroup>
이 코드를 제거하고 csproj를 저장 한 다음 프로젝트를 다시로드하면 작동합니다. 도움이 되었기를 바랍니다!
설치하는 가장 쉬운 방법은 npm 패키지 관리자를 사용하는 것입니다. angular2는 지금 타이핑과 함께 제공되기 때문입니다. 편집자는 모든 가져 오기 위치를 인식합니다 ...
ionic 2를 설치할 때이 문제가 발생했습니다. 모든 패키지 (package.json 업데이트)를 설치하고 npm을 v3으로 업데이트했습니다. 이것은 그것을 해결했습니다.
This has to be done for both 'Debug' and 'Release' then only it works in VS 2013. Like below..
<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>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptJSXEmit>
</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>
Developing with the ASP.NET Core Angular 2 Starter Application template from Mads Kristensen. I had a similar problem starting a new directory with Typescript files.
My solution was more simple than modifying the project file. I just copied the tsconfig.json from the ClientApp folder where all of the typescript files were to my new folder.
Just right click on "package.json"
and select "Restore Packages" after installation of Packages build it... your problem is solved
This is an Interesting issue, apart from the reasons and solution mentioned above, one can get this error on following scenarios.
NPM (Node Package Manager) is not installed on the machine
Fix: Install NPM from https://nodejs.org/en/
If you are still getting this error after Installing NPM, there could be NPM configuration issue. Refer to this article to setup NPM configuration properly
- In Visual Studio 2015, go to "Tools" menu and click on "Options...". You will be able to see a tree structure on the left side of the opened window.
- Expand "Projects and Solutions" and then select "External Web Tools". Now move "$(PATH)" entry above the "$(DevEnvDir)" entry.
- Click OK. Restart the Visual Studio.
- Now right click on the "package.json" file in the solution explorer and click on "Restore Packages".
Hi I got the same problem when I am using eclplse editor . I have executed the below command in my cmd window and I have restarted my eclipse . It is working as expected.
npm install --save @ angular / core @ angular / compiler @ angular / common @ angular / platform-browser @ angular / platform-browser-dynamic rxjs@5.0.0-beta.6 zone.js@0.6.12 @ angular / 양식
- 실행하려고 설치 NPM (프로젝트에서 lib에 누락 설치합니다) 명령을
- 폴더 / 프로젝트를 다시 엽니 다.
" package.json "을 마우스 오른쪽 버튼으로 클릭 한 다음 패키지 설치 옵션을 선택하면 터미널이 열리고 자동으로 올바른 루트 폴더로 이동하여 필요한 종속성이 설치됩니다.
package.json은 프로젝트를 실행하는 데 필요한 모든 종속성 목록을 나열합니다.
참고 URL : https://stackoverflow.com/questions/34488669/cannot-find-module-angular2-core
'IT TIP' 카테고리의 다른 글
EF 마이그레이션으로 프로덕션 데이터베이스를 업데이트해도됩니까? (0) | 2020.12.01 |
---|---|
Angular $ http가 PUT / POST 대신 OPTIONS를 보냅니다. (0) | 2020.12.01 |
XML 1.0에서 "제어"문자가 잘못된 이유는 무엇입니까? (0) | 2020.12.01 |
C #의 모니터 대 뮤텍스 (0) | 2020.12.01 |
열려있는 파일이 너무 많음 : 열려있는 파일 수, 파일 내용 및 JVM이 열 수있는 파일 수 (0) | 2020.12.01 |