angular: No provider for AnimationEngine! is thrown after switch from 5.0.0-rc.1 to 5.0.0-rc.5
I’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
The error:
ERROR { Error: StaticInjectorError[AnimationEngine]:
StaticInjectorError[AnimationEngine]:
NullInjectorError: No provider for AnimationEngine!
at _NullInjector.get (...core.umd.js:962:19)
at resolveToken (...\node_modules\@angular\core\bundles\core.umd.js:1250:24)
at tryResolveToken (...\node_modules\@angular\core\bundles\core.umd.js:1192:16)
at StaticInjector.get (...\node_modules\@angular\core\bundles\core.umd.js:1063:20)
at resolveToken (...\node_modules\@angular\core\bundles\core.umd.js:1250:24)
at tryResolveToken (...\node_modules\@angular\core\bundles\core.umd.js:1192:16)
at StaticInjector.get (...\node_modules\@angular\core\bundles\core.umd.js:1063:20)
at resolveNgModuleDep (...\node_modules\@angular\core\bundles\core.umd.js:10623:25)
at _callFactory (...\node_modules\@angular\core\bundles\core.umd.js:10689:67)
at _createProviderInstance$1 (...\node_modules\@angular\core\bundles\core.umd.js:10637:26)
is thrown on the server side rendering after switch from 5.0.0-rc.1 to 5.0.0-rc.5
Expected behavior
The error should not be thrown
Minimal reproduction of the problem with instructions
Server Ng Module
@NgModule({
imports: [
ServerModule,
ServerTransferStateModule
RouterModule.forRoot(ROUTES, { initialNavigation: 'enabled' }),
AppModule,
],
bootstrap: [AppComponent],
})
export class AppServerModule {
}
Common Ng Module
@NgModule({
imports: [
CommonModule,
FormsModule,
RouterModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
],
providers: [
...
],
declarations: [...],
})
export class AppModule {
}
Rendering code
import { Type } from '@angular/core';
import { renderModule } from '@angular/platform-server';
import * as express from 'express';
export function renderMiddleware(
templateFilePath: string,
module: Type<any>): express.RequestHandler {
return async function middleware(request: express.Request, resonse: express.Response): Promise<void> {
let result = await renderModule(module, {
document: getDocument(templateFilePath),
url: request.originalUrl,
});
resonse.send(result);
};
}
Environment
Angular version: 5.0.0-rc.5
For Tooling issues:
- Node version: 6.11.0
- Platform: Windows
Others:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 44 (30 by maintainers)
Commits related to this issue
- build(platform-server): add @angular/animations/browser to "external" list for rollup Fixes #19899 — committed to jasonaden/angular by jasonaden 7 years ago
- build(platform-server): add @angular/animations/browser to "external" list for rollup Fixes #19899 — committed to jasonaden/angular by jasonaden 7 years ago
For my project, the last working version is 5.0.0-rc.3. I tried the rc4, and it failed as well.
So something went wrong between the rc3 and the rc4
I described why it’s not working above based on the repo https://github.com/patrickmichalina/fusebox-angular-universal-starter/tree/provider-error
We have two different functions AnimationEngine in https://unpkg.com/ source. I manually replaced imports and it works
The reproduction is simply run
npm start
and FuseBox typechecker will throw theError StaticInejctorError[AnimationEngine]
It’s Windows 10.
Please compare build artifacts from https://unpkg.com/@angular/platform-server@5.0.0-rc.7/bundles/platform-server.umd.js and https://github.com/angular/platform-server-builds/blob/5.0.0-rc.7/bundles/platform-server.umd.js they are different
Looks like the fix didn’t make into rc.8
AnimationEngine
definition is still present in rc.8https://unpkg.com/@angular/platform-server@5.0.0-rc.8/bundles/platform-server.umd.js
Look also at https://unpkg.com/@angular/platform-server@5.0.0-rc.8/bundles/ Seems the bundle is big (343.24 kB)
The same we can see if we just create empty git repo and run
npm i @angular/platform-server@5.0.0-rc.8
then go to
./node_modules/@angular/platform-server/bundles/platform-server.umd.js
Ctrl+F
and typevar AnimationEngine
@patrickmichalina I checked out your branch and tried
npm start --aot
, but that shows some errors in the command line, and only opens a browser that lists the directory. Could you provide more details how to reproduce?Error I am seeing:
@alexzuza Ok. I made a branch that does not inject the firebase admin provider. And you can see the error on application start. This project does not use the angular-cli or webpack.
Moving beyond rc.3 triggers this error, was not happening before.
Upgraded this branch to rc.7
https://github.com/patrickmichalina/fusebox-angular-universal-starter/tree/provider-error