29

不知何故,VSCode 中的 Angular (v11.0.4) 语言服务不再起作用。我收到以下错误消息。:

[Info  - 17:52:04] Angular language server process ID: 147359
[Info  - 17:52:04] Using typescript/lib/tsserverlibrary v4.0.5 from ~/.vscode-oss/extensions/angular.ng-template-0.1100.2/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 17:52:04] Using @angular/language-service v11.0.3 from ~/.vscode-oss/extensions/angular.ng-template-0.1100.2/server/node_modules/@angular/language-service/bundles/language-service.js
[Info  - 17:52:04] Log file: ~/.config/Code - OSS/logs/20210112T090839/exthost2/Angular.ng-template/nglangsvc.log
[Info  - 17:52:06] Disabling language service for ~/Workspace/NG_PROJECT/tsconfig.json because it is not an Angular project ('@angular/core/core.d.ts' could not be found). If you believe you are seeing this message in error, please reinstall the packages in your package.json.
[Error - 17:52:06] Failed to find project for ~/Workspace/NG_PROJECT/projects/apps/app1/src/app/*.html
[Error - 17:52:53] No config file for ~/Workspace/NG_PROJECT/projects/apps/app1/src/app/*.html
[Error - 17:52:54] No config file for ~/Workspace/NG_PROJECT/projects/apps/app1/src/app/*.html

我已经尝试过:

rm -rf node_modules package-lock.json
npm cache clean --force
npm install

但这并不能解决问题。

我能做些什么来解决这个问题?

4

2 回答 2

43

更新到@Begandroide 的答案。“常春藤”不再被认为是实验性的,因此Enable-experimental-ivy-prompt不再是一种选择。使用Angular 语言服务VSCode 扩展的最新主要版本 (12.x...) ,您必须启用该Use legacy View Engine language service选项。

在此处输入图像描述

于 2021-06-04T14:18:38.803 回答
36

我遇到了同样的问题,我通过访问 VS Code 市场解决了这个问题,然后转到Angular language service扩展并单击设置,然后单击扩展设置在此处输入图像描述

最后,您必须禁用experimental-ivy 并重新加载窗口(VS Code) 在此处输入图像描述

于 2021-02-16T20:01:47.930 回答