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 read properties of null (reading 'bindingStartIndex') #55087

Closed
adamovicphactum opened this issue Mar 28, 2024 · 3 comments
Closed

Cannot read properties of null (reading 'bindingStartIndex') #55087

adamovicphactum opened this issue Mar 28, 2024 · 3 comments

Comments

@adamovicphactum
Copy link

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

compiler, core

Is this a regression?

Yes

Description

The error occurs when the library and webapp are in separate workspaces. Adding the following to the webapp/tsconfig.json:

"preserveSymlinks": true,
"paths": {
  "@angular/*": ["./node_modules/@angular/*"]
}

As mentioned in #35586 leads to:

chunk-UPPURN5U.js?v=362350fb:3784 ERROR Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203
    at injectInjectorOnly (core.mjs:1093:15)
    at ɵɵinject (core.mjs:1106:42)
    at Object.factory (core.mjs:27702:46)
    at chunk-UPPURN5U.js?v=362350fb:1898:35
    at runInInjectorProfilerContext (chunk-UPPURN5U.js?v=362350fb:523:5)
    at R3Injector.hydrate (chunk-UPPURN5U.js?v=362350fb:1897:11)
    at R3Injector.get (chunk-UPPURN5U.js?v=362350fb:1790:23)
    at definition.getStandaloneInjector (core.mjs:27718:31)
    at ComponentFactory.create (chunk-UPPURN5U.js?v=362350fb:9279:53)
    at _ApplicationRef.bootstrap (chunk-UPPURN5U.js?v=362350fb:17671:38)

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/lib-err

Please provide the exception or error you saw

ERROR TypeError: Cannot read properties of null (reading 'bindingStartIndex')
    at ɵɵelementStart (library.js?v=a9d1830e:14736:53)
    at MainComponent_Template (library.js?v=a9d1830e:21091:7)
    at executeTemplate (chunk-OYRBPOPR.js?v=5456b3f1:9302:5)
    at renderView (chunk-OYRBPOPR.js?v=5456b3f1:10088:7)
    at renderComponent (chunk-OYRBPOPR.js?v=5456b3f1:10070:3)
    at renderChildComponents (chunk-OYRBPOPR.js?v=5456b3f1:10117:5)
    at renderView (chunk-OYRBPOPR.js?v=5456b3f1:10102:7)
    at renderComponent (chunk-OYRBPOPR.js?v=5456b3f1:10070:3)
    at renderChildComponents (chunk-OYRBPOPR.js?v=5456b3f1:10117:5)
    at renderView (chunk-OYRBPOPR.js?v=5456b3f1:10102:7)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.3.2
Node: 18.18.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.2
@angular-devkit/build-angular   17.3.2
@angular-devkit/core            17.3.2
@angular-devkit/schematics      17.3.2
@angular/cli                    17.3.2
@schematics/angular             17.3.2
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else?

No response

@alxhub
Copy link
Member

alxhub commented Mar 28, 2024

This type of error is often seen when multiple versions of @angular/core are present within a bundle, which sounds plausible given the setup described. Likely both your application and library are pulling their own instance of @angular/core.

@JeanMeche
Copy link
Member

Let's continue the discussion in #35586.

@JeanMeche JeanMeche closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
@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 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants