Skip to content

ngcc fails and produces a confusing error when a library points to a non-existent file #40965

@lincolnthree

Description

@lincolnthree

Describe the bug

Angular language service crashing on startup due to ngcc failure. I believe this has been happening for a few versions, but haven't had time to report till now.

Error: Error on worker angular/vscode-ng-language-service#6: Error: Invariant violated: No format-path or format for /Users/lincoln/Desktop/example/node_modules/@rx-angular/template : main (formatPath: bundles/rx-angular-template.umd.js | format: undefined)

To Reproduce

Steps to reproduce the behavior:

  1. ng new (example, css)
  2. cd example
  3. npm i @rx-angular/template
  4. Add rx-angular PushModule to app.module.ts
  5. Restart vscode
  6. boom

Expected behavior

Language server should not crash.

Logs

Please attach two logs:

  1. Console output (Go to toolbar --> View --> Output, and copy the contents)
[Info  - 12:33:09 AM] Angular language server process ID: 97613
[Info  - 12:33:09 AM] Using typescript/lib/tsserverlibrary v4.1.5 from /Users/lincoln/.vscode/extensions/angular.ng-template-11.2.3/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 12:33:09 AM] Using @angular/language-service/bundles/ivy v11.2.2 from /Users/lincoln/.vscode/extensions/angular.ng-template-11.2.3/node_modules/@angular/language-service/bundles/ivy.js
[Info  - 12:33:09 AM] Log file: /Users/lincoln/Library/Application Support/Code/logs/20210219T103132/exthost6/Angular.ng-template/nglangsvc.log
[Info  - 12:33:09 AM] Disabling language service for /Users/lincoln/Desktop/example/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 - 12:33:16 AM] Failed to run ngcc for /Users/lincoln/Desktop/example/tsconfig.app.json:
    ngcc for /Users/lincoln/Desktop/example/tsconfig.app.json returned exit code 1, stderr: �[33mWarning:�[0m Entry point '@rx-angular/template/schematics' contains deep imports into '/Users/lincoln/Desktop/example/node_modules/@schematics/angular/utility/ast-utils', '/Users/lincoln/Desktop/example/node_modules/@schematics/angular/utility/dependencies'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Error: Error on worker angular/vscode-ng-language-service#6: Error: Invariant violated: No format-path or format for /Users/lincoln/Desktop/example/node_modules/@rx-angular/template : main (formatPath: bundles/rx-angular-template.umd.js | format: undefined)
    at /Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/create_compile_function.js:44:27
    at /Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:85:54
    at step (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:143:27)
    at Object.next (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:124:57)
    at /Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:113:16)
    at Worker.<anonymous> (/Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:72:78)
    at Worker.emit (events.js:315:20)
    at process.<anonymous> (internal/cluster/worker.js:32:12)
    at ClusterMaster.onWorkerMessage (/Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:143:27)
    at Object.next (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:124:57)
    at /Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/lincoln/Desktop/example/node_modules/tslib/tslib.js:113:16)
    at EventEmitter.<anonymous> (/Users/lincoln/Desktop/example/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:315:20)
    Language service will remain disabled.
[Info  - 12:33:16 AM] Enabling Ivy language service for /Users/lincoln/Desktop/example/tsconfig.app.json.

  1. Log file (Path is printed to the console output at startup)

nglangsvc.log

Screenshots

If applicable, add screenshots to help explain your problem.

Example Screenshot
image

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: language-serviceIssues related to Angular's VS Code language service

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions