Closed
Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- [x ] serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes. In Angular v8 and before, the browser would consistently show errors, regardless of when you executed `npm start`Description
What you see in the browser when you have an error depends on when you execute `npm start`. You may get this:
No error shown. Appears to display the last successfully compiled files.
You may get this:
Get error. This is very unhelpful, especially for Angular beginners. This appears if you run npm start
after making an error. It appears that it cannot serve any files in this case.
Or you may get lucky and get this:
This is much more helpful, but not consistently shown.
🔬 Minimal Reproduction
This is one example, but it happens with many different errors, such as forgetting to add a component to an Angular module:
- ng new APM
- cd APM
- code .
- Run npm start
- Add the following line to the template:
<input type='text' [(ngModel)]='listFilter' />
(This is an error because we don't have listFilter defined and we have not imported FormsModule.) - View the browser. No error.
- Using the F12 tools, you see the ngModel error.
- Stop the compiler.
- Restart the compiler and you see the black background and an error in the browser.
I assume this is the behavior that we should see in every case. - Remove the added input line. The code does not recompile and the browser still shows the error. So it appears as if it was not fixed.
- Stop the compiler.
- Add the above input element again (step Concatenate all source files #5)
- Start the compiler.
- This time you'll see the
cannot get
error.
So depending on when the npm start
is executed, the developer will see different results, some of which, like the cannot get
error, provide no information in the browser as to what is wrong.
🔥 Exception or Error
🌍 Your Environment
@angular-devkit/build-angular 0.901.1
@angular-devkit/build-optimizer 0.901.1
@angular-devkit/build-webpack 0.901.1
@angular-devkit/core 9.1.1
@angular-devkit/schematics 9.1.1
@ngtools/webpack 9.1.1
@schematics/angular 9.1.1
@schematics/update 0.901.1
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
Anything else relevant?
Similar issues: #15887