我正在尝试自动部署有角度的应用程序,虽然我可以使用--prod在本地构建项目,但是当我尝试在gitlab中构建它时,却遇到了我的一些(但不是全部)问题找不到组件。我的IDE可以毫无问题地找到所有这些。
我尝试重新排列提交,从一个新的ubuntu容器开始,在导入中从双引号改为单引号,等等。
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AssetFilesComponent } from './asset-files/asset-files.component';
import { GeomapComponent } from './geomap/geomap.component';
import { AssetTimeseriesViewerComponent } from './asset-timeseries/assettimeseries/asset-timeseries-viewer.component';
import { KpiComponent } from './kpi/kpi.component';
import { EventsComponent } from './events/events.component';
const routes: Routes = [
{ path: '', redirectTo: 'geomap', pathMatch: 'full'},
{ path: 'geomap', component: GeomapComponent },
{ path: 'asset-files', component: AssetFilesComponent },
{ path: 'kpis', component: KpiComponent },
{ path: 'asset-timeseries', component: AssetTimeseriesViewerComponent },
{ path: 'events', component: EventsComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AssetFilesComponent } from './asset-files/asset-files.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { GeomapComponent } from './geomap/geomap.component';
import { ChartModule } from './chart/chart.module';
import { KpiComponent } from './kpi/kpi.component';
import { EventsComponent } from './events/events.component';
import { AssetTimeseriesChartModule } from './asset-timeseries/asset-timeserieschart.module';
/* App Root */
import { AppComponent } from './app.component';
/* Routing Module */
import { AppRoutingModule } from './app-routing.module';
/* Building Blocks */
import { BuildingBlocksModule } from 'building-blocks';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
@NgModule({
declarations: [
AppComponent,
GeomapComponent,
AssetFilesComponent,
DashboardComponent,
KpiComponent,
EventsComponent
],
imports: [
BrowserModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
AppRoutingModule,
BrowserAnimationsModule,
HttpClientModule,
BuildingBlocksModule,
ChartModule,
AssetTimeseriesChartModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule { }
我从gitlab收到的消息如下:
Hash: 66dd67383385c874df28
Time: 89852ms
chunk {0} runtime.26209474bfa8dc87a77c.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.01ecbc0fcff9207e8cde.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills.a723c36635c3a098c2aa.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} styles.350a9b101128c3dd4672.css (styles) 960 kB [initial] [rendered]
chunk {scripts} scripts.9399614690f9a0599e1e.js (scripts) 2.31 MB [entry] [rendered]
ERROR in app/app.module.ts(36,5): Error during template compile of 'AppModule'
Could not resolve ./kpi/kpi.component relative to [object Object]..
src/app/app-routing.module.ts(5,48): error TS2307: Cannot find module './asset-timeseries/assettimeseries/asset-timeseries-viewer.component'.
src/app/app-routing.module.ts(6,30): error TS2307: Cannot find module './kpi/kpi.component'.
src/app/app-routing.module.ts(7,33): error TS2307: Cannot find module './events/events.component'.
src/app/app.module.ts(10,29): error TS2307: Cannot find module './chart/chart.module'.
src/app/app.module.ts(11,30): error TS2307: Cannot find module './kpi/kpi.component'.
src/app/app.module.ts(12,33): error TS2307: Cannot find module './events/events.component'.
src/app/app.module.ts(14,44): error TS2307: Cannot find module './asset-timeseries/asset-timeserieschart.module'.
就像我说的那样,这些模块肯定在那儿,紧挨着Angular不会抱怨的那些模块。我在Windows 10机器上本地构建,并尝试在Ubuntu容器中构建。我不确定这是否会有所作为。
感谢您的帮助。