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

Most upvoted comments

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 the Error StaticInejctorError[AnimationEngine]

1

2

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.8

https://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 type var 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:

/Users/tbosch/projects/repro/issue-19899/fusebox-angular-universal-starter/node_modules/fuse-box-typechecker/dist/commonjs/src/checker.ts:171
        let allErrors = Object.entries(groupedErrors)
                               ^
TypeError: Object.entries is not a function

@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

Error: StaticInjectorError[AnimationEngine]: 
  StaticInjectorError[AnimationEngine]: 
    NullInjectorError: No provider for AnimationEngine!
    at _NullInjector.get (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/di/injector.js:31:6)
    at resolveToken (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:1250:24)
    at tryResolveToken (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/di/injector.js:330:14)
    at StaticInjector.get (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/di/injector.js:170:15)
    at resolveToken (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:1250:24)
    at tryResolveToken (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/di/injector.js:330:14)
    at StaticInjector.get (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/di/injector.js:170:15)
    at resolveNgModuleDep (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:10623:25)
    at _callFactory (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/view/ng_module.js:173:14)
    at _createProviderInstance$1 (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/view/ng_module.js:121:17)
    at resolveNgModuleDep (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/view/ng_module.js:103:2)
    at NgModuleRef_.get (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:11844:16)
    at Object.createProdRootView [as createRootView] (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:14063:62)
    at ComponentFactory_.create (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/view/refs.js:114:44)
    at ComponentFactoryBoundToModule.create (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/@angular/core/bundles/core.umd.js:3958:29)
    at ApplicationRef.bootstrap (/Users/Patrick/Repos/fusebox-angular-universal-starter/node_modules/packages/core/esm5/src/application_ref.js:686:55)