Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve definitions from pnpm modules #657

Closed
lucas-labs opened this issue Feb 22, 2020 · 10 comments
Closed

Cannot resolve definitions from pnpm modules #657

lucas-labs opened this issue Feb 22, 2020 · 10 comments
Assignees
Labels
bug lib Relates to an issue in the @angular/language-service library

Comments

@lucas-labs
Copy link

Describe the bug

We are getting an error when using some pipes since we updated Angular Language Service to 0.900.14.

For example, in one of our components we have the following variable:

export class LuBadgeComponent implements OnInit {
    @Input() label: string;
    ...
}

Then, in the template we use the uppercase pipe on it:

<p>
    {{ label | uppercase }}
</p>

And we're getting the following error in VS Code:

image

To Reproduce

Steps to reproduce the behavior:

  1. Create a component with a string variable
  2. Use the uppercase pipe on the variable inside the template
  3. See error

(see the example above)

Expected behavior

We expect no error from this piece of code since the code compiles correctly:

image

Logs

Please attach two logs:

  1. Console output
[Info  - 18:18:10] Angular language server process ID: 8428
[Info  - 18:18:10] Using typescript v3.7.4 from c:\Users\lucas\.vscode\extensions\angular.ng-template-0.900.14\node_modules\typescript\lib\tsserverlibrary.js
[Info  - 18:18:10] Using @angular/language-service v9.0.2 from c:\Users\lucas\.vscode\extensions\angular.ng-template-0.900.14\server\node_modules\@angular\language-service\bundles\language-service.umd.js
[Info  - 18:18:10] Log file: c:\Users\lucas\AppData\Roaming\Code\logs\20200221T181704\exthost1\Angular.ng-template\nglangsvc.log
  1. Log file
    nglangsvc.log

Screenshots
image

Additional context

Add any other context about the problem here.

@lucas-labs lucas-labs added the bug label Feb 22, 2020
@ayazhafiz
Copy link
Member

ayazhafiz commented Feb 22, 2020

Do you have @angular/common in your node_modules? Also, are you building with Angular 9?

@ayazhafiz ayazhafiz added the lib Relates to an issue in the @angular/language-service library label Feb 23, 2020
@lucas-labs
Copy link
Author

Hi @ayazhafiz, thanks for the answer. I do have @angular/common in my node_modules.

image

But, I'm using pnpm and not npm. May that be the problem? The app compiles ok and I'm sure it was working fine and without showing this error in vscode like 2 months ago.

@lucas-labs
Copy link
Author

@ayazhafiz Regarding your question about my Angular version, I'm working with v8.2.8 in this project:
image

@ayazhafiz
Copy link
Member

I think pnpm is the issue. I just made a project with pnpm and repro'd your issue

@ayazhafiz
Copy link
Member

Not sure what we need to do to support pnpm. Looks like there is some existing issues with this on the TS side (microsoft/TypeScript#35206, microsoft/TypeScript#29221). Community contributions and suggestions are welcome.

@ayazhafiz ayazhafiz changed the title [Error] Unable to resolve signature for pipe invocation Cannot resolve definitions from pnpm module Feb 26, 2020
@ayazhafiz ayazhafiz changed the title Cannot resolve definitions from pnpm module Cannot resolve definitions from pnpm modules Feb 26, 2020
@clov3r
Copy link

clov3r commented Feb 26, 2020

Doesn't appear to be just pnpm. I just started getting these same errors tonight, using regular npm.

Screen Shot 2020-02-25 at 22 13 05pm

Screen Shot 2020-02-25 at 22 13 49pm

Screen Shot 2020-02-25 at 22 14 00pm

@ayazhafiz
Copy link
Member

@clov3r can you provide us with more details (per https://github.com/angular/vscode-ng-language-service/blob/master/.github/ISSUE_TEMPLATE/bug_report.md)? There are a number of reasons this error might appear.

@ivanwonder
Copy link
Contributor

{
  "compilerOptions": {
    "preserveSymlinks": true
  }
}

I have submitted a PR.
@lucas-labs @clov3r I think this config can resolve the problem too.

@ayazhafiz
Copy link
Member

Fixed by @ivanwonder's PR :)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug lib Relates to an issue in the @angular/language-service library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants