Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata_resolver.js Uncaught Error: Can't resolve all parameters for UserService: (Http, ?). #4

Open
nextstopsun opened this issue Sep 25, 2016 · 2 comments

Comments

@nextstopsun
Copy link

nextstopsun commented Sep 25, 2016

I'm trying to run this example as an Angular CLI app. It uses webpack by default instead of SystemJS. The bundle gets built with no errors, but I've got this error on the page:

metadata_resolver.js:508 Uncaught Error: Can't resolve all parameters for UserService: (Http, ?).

CompileMetadataResolver.getDependenciesMetadata @   metadata_resolver.js:508
CompileMetadataResolver.getTypeMetadata @   metadata_resolver.js:405
(anonymous function)    @   metadata_resolver.js:552
CompileMetadataResolver.getProvidersMetadata    @   metadata_resolver.js:532
CompileMetadataResolver.getNgModuleMetadata @   metadata_resolver.js:285
RuntimeCompiler._compileComponents  @   runtime_compiler.js:126
RuntimeCompiler._compileModuleAndComponents @   runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync  @   runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone   @   application_ref.js:303
PlatformRef_.bootstrapModule    @   application_ref.js:285
(anonymous function)    @   main.ts:12
__webpack_require__ @   bootstrap 4990ebf…:52
(anonymous function)    @   zone.js:1327
__webpack_require__ @   bootstrap 4990ebf…:52
webpackJsonpCallback    @   bootstrap 4990ebf…:23
(anonymous function)    @   main.bundle.js:1

I guess it has something to do with the second argument of UserService constructor, which is of type AuthenticationService: private authenticationService: AuthenticationService.

@cornflourblue Can you please give a clue how to solve this error? I'm a noob in Angular and webpack seems a lot more easier (with literally no configuration) than SystemJS.

@morgdenn
Copy link

morgdenn commented Oct 1, 2016

I'm doing the same thing and have the same problem.

I'm not sure why this worked but I fixed it by changing import { AuthenticationService } from './index'; to import { AuthenticationService } from './authentication.service'; in user.service.ts

@PooperPig
Copy link

I was literally about to try that, then thought 'nah - why would that make a difference?'
Then found @morgdenn 's comment - and it worked for me, too!

I'd love to know why this makes a difference!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants