0

I have many imported npm modules in my Android 12 project. The ones imported a while ago works fine, but lately every new one shows errors.

First I thought it was one package issue, but I tried importing a few modules and have the same problem.

So for example, imported ngx-scrollbar package: Here is package.json

"ngx-scrollbar": "^8.0.0",

Imported in my app.module:

import { NgScrollbarModule } from 'ngx-scrollbar';
imports: [
   ...
   NgScrollbarModule

ALS shows this: enter image description here (for this and every other new module imported) The project compiles succesfully, but with this I cannot use ALS. My ALS is latest version (14.1.0); I tried reverting to older version, no effect. I am sure that this is ALS, because when I turned it off, the error was not showing up.

Filip Witkowski
  • 795
  • 3
  • 14
  • 24
  • Have you tried restarting your Angular Language server? You can do it by doing CTRL + Shift + P and choosing Restart Angular Language server. Sometimes it's just throwing the error like yours, but all in all everything is fine, code compiles successfully. – Chaka15 Jul 31 '22 at 17:01
  • Yes, I did that. – Filip Witkowski Aug 02 '22 at 15:06

2 Answers2

1

Sometimes VS Code works not best with plugins. It often happens if you use not a single workspace project, but multiple projects or monorepository.

For this error you just need to go to the npm module and open it in VS Code. Just click with Cmd on NgScrollbarModule in your case, it opens tab with code of that module. And then VS Code ALS will know everything is OK.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Anton Marinenko
  • 2,749
  • 1
  • 10
  • 16
  • This is great advice for the future (if I would have this issue with single plugin), However, this was happening with every new plugin I was trying to add. I found that with was actually issue with ALS settings, see below. – Filip Witkowski Aug 06 '22 at 14:14
0

I did compare with other VS code on other machine (where the error was not showing up).

I found that in Angular Language Services (v 14.1.0) turning of View Engine fixed the issue.

It says that "This option is incompatible with projects using Angular v13 and above." Even thought my project uses Angular v 12, this setting still caused problems.

Filip Witkowski
  • 795
  • 3
  • 14
  • 24