question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular2(2.4.6) with latest cli giving error on ng serve in browser

See original GitHub issue

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Window 7

Versions.

Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here: 2.4.6

Repro steps.

Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. No, it was built with angular-cli beta 18

The log given by the failure.

Normally this include a stack trace and some more information.

Unhandled Promise rejection: appInits[i] is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: appInits[i] is not a function

Mention any other details that might be useful.

NG-CLi - 1.0.0-beta.28.3 Angular2 : 2.4.6 here is my function in app.module.ts

export function authFactory(auth : LoginService){ return auth.loginUser(); }

Providers are reference like this in app.module.ts

{ provide: APP_INITIALIZER, //useFactory: (auth: AuthService) => () => auth.authUser(), useFactory : authFactory, deps: [LoginService], multi: true }

When app runs, browser is giving error

Unhandled Promise rejection: appInits[i] is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: appInits[i] is not a function

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

33reactions
GopiAnnancommented, Apr 4, 2017

Still any one looking for answer on this,

Instead of this export function authFactory(auth : LoginService){ return auth.loginUser(); } has to be changed to export function authFactory(auth : LoginService){ return () => auth.loginUser(); }

2reactions
inthegaragecommented, Jul 7, 2017

@GopiAnnan For president, the best solution of 2017. In all environments, for all languages and operating systems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng serve error while running in angular 2 application
I have first installed angular-cli with npm install -g angular-cli command and created an angular-cli project. Then I created the project with ...
Read more >
Setting up the local environment and workspace - Angular
Run the applicationlink ... The Angular CLI includes a server, for you to build and serve your app locally. ... The ng serve...
Read more >
Upgrade Angular 5 app to Angular 6 with Visual Studio 2017
First, Update the Angular CLI to the latest version globally using ... Now, run ng serve to see the application is building and...
Read more >
How to work with Angular CLI | Angular Forums - Syncfusion
I have tried many ways to use the Grid component with Angular CLI project but failed with following error. I am wondering if...
Read more >
Angular IDE - problem starting 'Angular CLI' server - Genuitec
The app I'm working on has been generated with angular-cli 1.0.0-beta.24 and then successfully imported into AngularIDE as 'Angular 2 Project', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found