0

I want to sart an angular project I have already install angular/cli and i have created the project with ng new mon-premier-projet but when i start the serve ng serve I get this error

node_modules/@angular/router/router.d.ts:2631:22 - error NG6003: Appears in the NgModule.exports of AppRoutingModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.

This likely means that the library (@angular/router) which declares RouterModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

2631 export declare class RouterModule {
                          ~~~~~~~~~~~~
node_modules/@angular/platform-browser/platform-browser.d.ts:44:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/platform-browser) which declares BrowserModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

44 export declare class BrowserModule {
                        ~~~~~~~~~~~~~
src/app/app-routing.module.ts:10:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors

10 export class AppRoutingModule { }

and localhost:4200 return cannot get/ please help me solve that problem

Etali
  • 131
  • 2
  • 11

1 Answers1

5

I add this to my tsconfig.app.json file from

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

to

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ],
  "angularCompilerOptions": {
    "enableIvy": false
  }
}

And it works :) Just add

"angularCompilerOptions": {
    "enableIvy": false
  }```
link https://angular.io/guide/ivy
Etali
  • 131
  • 2
  • 11