question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fail to detect older Angular projects < v9

See original GitHub issue

🐞 bug report

Is this a regression?

Kinda, since the extension will not correctly detect the project’s Angular version and set the default setting to a proper value. A lot of developers will have this issue so that’s the main reason of this issue report.

Note: I’m actually working on a project whose Angular version can’t be updated at the moment.

Description

Latest extension release states:

Older projects will keep using View Engine language service.

By the way, it doesn’t seem to work, and it will raise the following error for older Angular projects:

Failed to resolve ngcc [...] Language service will remain disabled.

Bug Type

What does this bug affect

  • Angular Language Service VSCode extension
  • Angular Language Service server

Reproduction

  1. Open an Angular < v9 project (not sure about the version, personally I’m on v7)
  2. The Failed to resolve ngcc error will be displayed and the extension will not work

Expected behavior

The extension should be able to detect a pre-ivy project and automatically enable the angular.view-engine setting.

“Temporary fix”

Set the angular.view-engine workspace setting to true.

Logs

Popup displayed:

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.

🌍 Your Environment

Angular Version:

Angular CLI: 7.1.4
Node: 10.16.0
OS: win32 x64
Angular: 7.1.4

Extension Version:

v12.0.0

VSCode Version:

v1.56.1

Operating System:

Windows 10 Version 10.0.19042 Build 19042

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:17
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
kyliaucommented, May 13, 2021

Yeah, our goal is to make the extension detect the right Angular version, and pick the language service accordingly. There should be no manual configuration needed on the user’s side.

Meanwhile, if your project is using Angular < v9, you can explicitly tell the extension to use View Engine language service by checking the View Engine option in vscode Workspace settings (not User, as that’ll affect all projects):

Screen Shot 2021-05-13 at 9 49 28 AM
2reactions
ivanwondercommented, May 15, 2021

@kyliau I think the problem is the default value. https://github.com/angular/vscode-ng-language-service/blob/ee741f8e90accd67326aff1c74d61e8181c7e473/package.json#L87 https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration Looks like the vscode treats it as false if I remove the default value.

So if the config value is falsy, just use the value returned by checking the project’s angular version.

const viewEngine: boolean = config.get('angular.view-engine') || !allProjectsSupportIvy();
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Unable to get Angular CLI version, though all the ...
My solution was to simply go to the node.js download website, get the current/latest version of the software and install it on my...
Read more >
Keeping your Angular projects up-to-date
To check your application's version of Angular: From within your project directory, use the ng version command. Finding the current version of Angularlink....
Read more >
the installed angular cli version is older than the latest stable ...
I'm getting this error when trying to update my angular project from version 9.1 to 10. Even when I try to update another...
Read more >
How To Update Angular CLI To Latest Version
To update Angular CLI version in your local projects use the following commands. Navigate to your local Angular project folder and execute the ......
Read more >
How to generate apps with older @angular/cli versions
You need to install the @angular/cli at a particular version. Perhaps install the latest (~8 at the time of this writing) CLI globally....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found