私のプロジェクトは[Angular CLI]バージョン1.2.6で生成されました。
プロジェクトをコンパイルして問題なく機能しますが、vsコードで常にエラーが発生し、モジュール '@ angular / core'が見つかりませんモジュール '@ angular / router'がモジュールを見つけられません.....
私のtsconfig.jsonファイルのコンテンツを添付しました。これは私にとって本当にイライラしました。何が問題かを理解するために2時間を費やしました。また、機能しないvsコードをアンインストールして再インストールしました。
ここに私の環境仕様があります:
@angular/cli: 1.2.6
node: 6.9.1
os: win32 x64
@angular/animations: 4.3.4
@angular/common: 4.3.4
@angular/compiler: 4.3.4
@angular/core: 4.3.4
@angular/forms: 4.3.4
@angular/http: 4.3.4
@angular/platform-browser: 4.3.4
@angular/platform-browser-dynamic: 4.3.4
@angular/router: 4.3.4
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.4
@angular/language-service: 4.3.4
os:Microsoft対10エンタープライズ
プロジェクトルートフォルダ
.angular-cli.json
.editorconfig
.gitignore
.vscode
e2e
karma.conf.js
node_modules
package.json
protractor.conf.js
README.md
src
tsconfig.json
tslint.json
node_moduleフォルダー
-@angular
--animations
--cli
--common
--compiler
--compiler-cli
--core
---@angular
---bundles
---core.d.ts
---core.metadata.json
---package.json
---public_api.d.ts
---README.md
---src
---testing
---testing.d.ts
---testing.metadata.json
--forms
--http
--language-service
--platform-browser
--platform-browser-dynamic
--router
--tsc-wrapped
@ng-bootstrap
@ngtools
-@types
--jasmine
--jasminewd2
--node
--q
--selenium-webdriver
tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
既にインストールしたすべての拡張機能をアンインストールしましたが、以下のアドレスからのJavaScriptおよびTypeScript IntelliSense拡張機能が問題の原因であることがわかりました。https://marketplace.visualstudio.com/items?itemName=sourcegraph.javascript-typescript
ここでのポイントは、黄色のラベルがあるプレビューWebサイトにアクセスしたときにプレビューリリースであることを示していますが、vs拡張機能を参照すると、そのラベルは表示されません。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加