Angular5: StaticInjectorError // Solution: `--preserve-symlinks`
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
Several StaticInjectionError
being reported.
How To Reproduce
Reproducible in the Angular CLI consumer in the integration tests:
$ cd integration/consumers/ng-cli
$ ng serve
(ng build
in the CI tests work fine though!)
Expected Behaviour
needs investigation
Version Information
ng-packagr: next
node: v8.9.0
@angular: v5.0.1
typescript: 2.4.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Preserve Symlinks in Angular Libraries - Stack Overflow
I'm trying to make a Angular 8 Library using ng-cli, but i can't preserve symlinks from my external application using npm link ....
Read more >[Solved]-Angular testing with primeng : NullInjectorError ...
Coding example for the question Angular testing with primeng ... Accepted answer. SOLVED. My angular.json's test section (added "preserveSymlinks": true):
Read more >Angular library integration of devExtrme controls
when I use this shared library in other angular application I am getting static injection error. JavaScript. Error: StaticInjectorError( ...
Read more >Angular6: No Provider for Injector when using local library – iTecNote
I'm somewhat new to Angular versions post AngularJS and decided to give them a try. ... Error: StaticInjectorError(AppModule)[MyButtonModule -> Injector]: ...
Read more >How to Create & Publish an Angular Library with Ionic ...
Since a later version the Angular CLI allows to create a workspace ... Ionic project and add the preserveSymlinks entry at the shown...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still facing the issue Uncaught (in promise): Error: StaticInjectorError Any solution on it.
Using Angular cli 1.5.4 and Angular 5.0.0 Created the service library which contained the httpclient.post() call and create the package using ng-packager. In consumer app added the service library package using npm.
On run time when we run the application it throw the error Uncaught (in promise): Error: StaticInjectorError No provider for httpclient
If we tested the service library code without consuming in any application it work as expected. when we consumed in any application and run that application it throw the run time error
Also try preserveSymlinks in angular.cli.json file in consumer application however no success still the error present run time. “defaults”: { “styleExt”: “css”, “build”: { “preserveSymlinks”: true }, “component”: {} } ***Service code application name - CommonApp
test.service.ts simply added the httpClient in constructor,
@Injectable() export class TestService {
}
The issue is resolved Updated angular cli and added “build”: { “preserveSymlinks”: true }, It’s working now.
I spoke too soon… looks like this is a preserveSymlinks thing helps, because I was testing the inclusion of my lib into a new dummy test app. This helps in debugging, but is this preserveSymlinks thing only a problem because of the npm link? (Should I be able to move forward and expcet my library to be installed into a new app from npm and just work?)