StaticInjectionError for service after migrating to Angular 5. // Solution: `--preserve-symlinks`
See original GitHub issueType of Issue
Service package error after migrate to Angular 5
[x] Bug Report [ ] Feature Request
## Description
I have an Angular CLI generated project that just has only one service file my-test.service.ts
@Injectable()
export class MyTestService {
......
}
I publish it to NPM using ng-packagr. I can use the package in my other projects before migrating to Angular 5. After migration, I got error:
ERROR Error: StaticInjectorError[MyTestService]:
StaticInjectorError[MyTestService]:
NullInjectorError: No provider for MyTestService!
at _NullInjector.get (core.js:923)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveNgModuleDep (core.js:10585)
at NgModuleRef_.get (core.js:11806)
at resolveDep (core.js:12302)
#### How To Reproduce
#### Expected Behaviour
#### Version Information
ng-packagr: v1.6.0 node: v8.x.y @angular: v5.0.0 rxjs: zone.js:
_please include any version information that might be relevant, e.g. other third-party libraries_
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (7 by maintainers)
Top Results From Across the Web
Bountysource
StaticInjectionError for service after migrating to Angular 5. // Solution: `--preserve-symlinks`
Read more >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 >Workspace and project file structure - Angular
The following command creates a workspace with all of the workspace-wide configuration files, but no root-level application. content_copy ng new my-workspace ...
Read more >Ng build --prod 不工作angular 8, Ng build --prod 失败, Ng build ...
Angular5 应用程序在使用ng build --prod 进行生产构建后失败. 解析模块时不要使用真实路径。如果未设置,则如果设置了NodeJS 选项--preserve-symlinks,则默认为true ...
Read more >Upgrade Angular 5 app to Angular 6 with Visual Studio 2017
First, Update the Angular CLI to the latest version globally using following command: · Next, we need to update Angular CLI local version ......
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
Why is this closed? It seems it is not fixed, or is it? I see neither a fix nor a clear explanation.
@dherges should this really be closed?