Unexpected value 'undefined' declared by the module 'AppModule'

Solution 1:

I got the same error , sometimes this issue occur and you only need to re-run the server using ng serve or whatever CLI you use , as mentioned here

Solution 2:

I faced the same error and I discovered the reason. The reason was two commas ,, in any array (for example: imports property) like this.

@NgModule({
  imports: [
  CommonModule, FormsModule,,
]})