Running Angular 12 locally is smooth with no errors in the project build.
Local Configuration:
Angular CLI: 12.0.5
Node: 12.16.3
Package Manager: npm 6.14.4
OS: win32 x64
Angular: 12.0.5
However, when attempting to build the project on a Linux server, an error occurs with limited information for troubleshooting.
Server Configuration:
Angular CLI: 12.0.5
Node: 14.18.1
Package Manager: npm 6.14.15
OS: linux x64
Angular: 12.0.5
Error: src/app/app-routing.module.ts:34:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
34 export class AppRoutingModule { }
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { NotifyFormComponent } from './notify-form/notify-form.component';
import { LoginComponent } from './login/login.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
HeaderComponent,
FooterComponent,
NotifyFormComponent,
LoginComponent
],
imports: [
AppRoutingModule,
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app-routing.module.ts
import { LoginComponent } from './login/login.component';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { NotifyFormComponent } from './notify-form/notify-form.component';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{path:'',redirectTo:'/',pathMatch: 'full'},
{
path:'',
component: HomeComponent,
children:[
]
},
{
path:'notify',
component: NotifyFormComponent
},
{
path:'login',
component: LoginComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
If there are any glaring issues I'm missing, please offer your assistance as this is just a basic test project. Thank you in advance.