You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main.ts:27 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
spend days debugging the issue
solved by adding preserveSymlinks: true.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
main.ts:27 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
Please provide the environment you discovered this bug in (run ng version)
preserveSymlinks is not well documented (even after the solution I have no idea what it actually preserves), and the error message anything but points to the missing configuration. A more helpful error message would be great!
The text was updated successfully, but these errors were encountered:
Without preserveSymlinks, the real path of a symlink is being used instead of retaining the original path. For example, consider the following structure:
Then, a path like /app/lib/entrypoint.ts either remains as is (preserveSymlinks=true) , or is replaced with /lib/entrypoint.ts (preserveSymlinks=false). This then affects module resolution, as it either finds /app/node_modulesor/lib/node_modules. in the latter case introducing a secondary copy of @angular/core. That results in a runtime that gets confused, as the two runtimes are not aware of each other and don't have access to the proper state.
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
Repro:
Observe: modules cannot be resolved
preserveSymlinks: true
.Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
preserveSymlinks
is not well documented (even after the solution I have no idea what it actually preserves), and the error message anything but points to the missing configuration. A more helpful error message would be great!The text was updated successfully, but these errors were encountered: