Tuesday, 23 May 2017

Getting 'Module not found' although file exists

I downloaded the angular starter and ran the app and it ran well. Now I Added a new file "people.service.ts" located in "src/app/services/people.service.ts".

When I try to import it, I get an error:

Module not found: Error: Can't resolve 'services/people.service' in '/path-to-project/angular-starter-master/src/app'

This is the code I use to import it (in src/app/app.module.ts):

import {PeopleService} from 'services/people.service';

I'm sure that there's no typos because the IDE recognizes it. There isn't any TypeScript error in the entire project. The file 'services/people.service' does contain a class named PeopleService.

Any help will be profoundly appreciated. Please let me know if you need any additional information.



via Alon

No comments:

Post a Comment