angular: Angular Language Service ngcc error in VSCode 1.62.1 and above

Which @angular/* package(s) are the source of the bug?

language-service

Is this a regression?

Yes

Description

I’ve upgraded to Angular 12 and I’ve installed the latest 12.x version VSIX of @angular/language-service extension in VSCode. But I get a popup error in the bottom right corner.

Angular extension might not work correctly because ngcc operation failed. Try to invoke ngcc manually by running 'npm/yarn run ngcc'. Please see the extension output for more information.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

This is the OUTPUT:
[Info  - 7:04:14 AM] Angular language server process ID: 34020
[Info  - 7:04:14 AM] Using typescript/lib/tsserverlibrary v4.3.5 from /Users/jyoutsey/src/myorg/ng/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 7:04:14 AM] Using @angular/language-service v12.2.12 from /Users/jyoutsey/.vscode/extensions/angular.ng-template-12.2.3/node_modules/@angular/language-service/index.js
[Info  - 7:04:14 AM] Logging is turned off. To enable, run command 'Open Angular server log'.
[Error - 7:04:39 AM] Failed to run ngcc for /Users/jyoutsey/src/myorg/ng/tsconfig.json, language service may not operate correctly:
    ngcc for /Users/jyoutsey/src/myorg/ng/tsconfig.json returned exit code null, stderr: 
[Info  - 7:04:39 AM] Enabling Ivy language service for /Users/jyoutsey/src/myorg/ng/tsconfig.json.

Please provide the environment you discovered this bug in

Angular CLI: 12.2.13
Node: 14.15.1
Package Manager: npm 6.14.11
OS: darwin x64

Angular: 12.2.13
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1202.13
@angular-devkit/build-angular      12.2.13
@angular-devkit/core               12.2.13
@angular-devkit/schematics         12.2.13
@angular/cdk                       12.2.12
@angular/material                  12.2.12
@angular/material-moment-adapter   12.2.12
@schematics/angular                12.2.13
rxjs                               7.4.0
typescript                         4.3.5

Anything else?

I’ve uninstalled the extension, restarted VSCode, and installed it again, to no avail.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Closing as resolved in the 1.62.3 release of VSCode.

@RobertAKARobin The fix was included in their latest insider version release but I’ve been leaving this open for visibility until their recovery release this week (1.62.3 I believe). There’s nothing to be done on our end since it was a bug in VSCode.

Downgrading the severity here to P3. We are still actively investigating this issue and are tracking https://github.com/microsoft/vscode/issues/136988 as the likely resolution.

In the meantime, the error we show does give the appropriate information. ngcc failed to run, which might cause the language service to not work correctly but can be resolved by npm/yarn run ngcc. Or if you are already running a dev server, ngcc likely already ran and you don’t have to do anything.

Just wanted to add as others have noted, rolling back to the September 2021 v1.61.2 VSCode release fixes this issue for me on the Mac. https://code.visualstudio.com/updates/v1_61

Look at the output for the Mac - strange that ngcc fails and then right after is does a “Enabling Ivy language service” on same file.

Right, we still enable the language service even if ngcc fails because you might be able to resolve the issue yourself. The popup error mentions “Try to invoke ngcc manually by running ‘npm/yarn run ngcc’”. If that works, then the language service can still function correctly. In reality, ngcc doesn’t have to run all the time. If you’re running your application, it likely already ran ngcc so the language service doesn’t necessarily need to. We just can’t rely on this being the case.