Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source File Not Found in Angular CLI project

Hi I have this folders in my project Folders But When I run I get this error Error

Any idea please?

regards

like image 309
kintela Avatar asked May 08 '18 11:05

kintela


4 Answers

Rerunning ng serve should help fix the issue. You must have added empleado.ts while the local server was still running, hence Angular would not have seen the file.

like image 108
Hisham Ahamad Avatar answered Oct 20 '22 02:10

Hisham Ahamad


Thanks to @Hisham Afzal Ahamed for the solution (stopping and re-starting the Angular compiler).

  • Stop the compiler: CTRL-C, CTRL-C (or CTRL-C then Y)
  • Restart: ng serve (or whatever else you're using e.g. a custom npm script)

Basically the Angular CLI sometimes doesn’t ‘see’ files that have been pulled in (e.g. when doing a merge while your compiler is running). Very useful to know. As a general time saver, If you’re pulling files into your solution or doing something similar, or you get an Angular compiler error that makes no sense, or you've made significant changes somehow, it’s always worth stopping then restarting the compiler to do a fresh build - it can save so many headaches!

like image 28
Chris Halcrow Avatar answered Oct 20 '22 03:10

Chris Halcrow


When application is running state and at that if you add a file with some export class then it through this type error

ERROR in Source file not found: '/C/abc/xyz/pqr/apps/src/app/comm/ab.ts'.

Solution

restart application again then it works.

By using npm start command

like image 5
Manoj Gupta Avatar answered Oct 20 '22 03:10

Manoj Gupta


After execute npm start again all works fine Thanks

like image 3
kintela Avatar answered Oct 20 '22 04:10

kintela