我正在处理一个Angular项目,最近我更改了工作环境。我安装了Node,从git中提取了项目,现在尝试使用“ ng build --prod”构建项目时出现错误:
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {NgModule} from '@angular/core';
import {AppComponent} from './app.component';
import {ProductComponent} from './product/product.component';
import {HeaderComponent} from './header/header.component';
import {CalculateComponent} from './calculate/calculate.component';
import {FooterComponent} from './footer/footer.component';
import {TradeMainComponent} from './trade-main/trade-main.component';
import {CatalogComponent} from './catalog/catalog.component';
import {FormsModule} from '@angular/forms';
import {RouterModule, Routes} from '@angular/router';
import {ChooserComponent} from './chooser/chooser.component';
import {DragScrollModule} from 'ngx-drag-scroll';
import {OrderService} from './order.service';
import {AgmCoreModule} from '@agm/core';
import {HttpClientModule} from '@angular/common/http';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {InfoComponent} from './info/info.component';
import {MainComponent} from './main/main.component';
import { AdviceStepFirstComponent } from './advice-step-first/advice-step-first.component';
import { AdviceStepSecondComponent } from './advice-step-second/advice-step-second.component';
import {AnimateOnScrollModule} from 'ng2-animate-on-scroll';
const routes: Routes = [
{
path: '', component: MainComponent, data: {page: 'main'}, children: [
{path: '', component: ChooserComponent, pathMatch: 'full'},
{path: 'price-list', component: CatalogComponent, data: {page: 'price_list'}},
{path: 'calculate', component: CalculateComponent, data: {page: 'calculate'}},
{path: 'advice-step-first', component: AdviceStepFirstComponent, data: {page: 'advice-step-first'}},
{path: 'advice-step-second', component: AdviceStepSecondComponent, data: {page: 'advice-step-second'}},
]
},
{path: 'price-list-main', component: CatalogComponent, data: {page: 'price_list'}},
{path: 'calculate-main', component: CalculateComponent, data: {page: 'calculate'}},
];
@NgModule({
declarations: [
AppComponent,
ProductComponent,
HeaderComponent,
CalculateComponent, FooterComponent, TradeMainComponent, CatalogComponent, ChooserComponent, InfoComponent, MainComponent, AdviceStepFirstComponent, AdviceStepSecondComponent
],
imports: [
BrowserAnimationsModule,
BrowserModule,
FormsModule,
RouterModule.forRoot(routes),
DragScrollModule,
AgmCoreModule.forRoot({
apiKey: 'AIzaSyBVIv8aITm71woalbx6GFFMv1rI9lE6U5k'
}),
HttpClientModule,
NgbModule.forRoot(),
AnimateOnScrollModule.forRoot()
],
providers: [OrderService],
bootstrap: [AppComponent]
})
export class AppModule {
}
虽然在装有Windows 7的旧笔记本电脑上工作正常。目前,我正在使用Windows 10。 AppModule:
Sub ABPerm()
Dim Acol As Integer
Dim Bcol As Integer
Dim RowNumA As Integer
Dim RowNumB As Integer
Dim RowNumC As Integer
Acol = Range("A" & Rows.Count).End(xlUp).Row
Bcol = Range("B" & Rows.Count).End(xlUp).Row
RowNumA = 1
RowNumB = 1
RowNumC = 1
For a = 1 To Acol
For b = 1 To Bcol
Range("C" & RowNumC).Value = Range("A" & RowNumA).Value & "-" & Range("B" & RowNumB).Value
RowNumB = RowNumB + 1
RowNumC = RowNumC + 1
Next b
RowNumB = 1
RowNumA = RowNumA + 1
Next a
End Sub
即使我删除AnimateOnScrollModule,我也会在其他一些库/模块上得到错误。我只是不知道如何解决这个问题。是否有针对构建应用程序故障的全局解决方案?
答案 0 :(得分:0)
该库的早期版本无法在较新版本的angular编译器(5.x及更高版本)上进行编译。似乎在更改工作环境时,已更新了角度编译器版本,但库版本仍然相同。
尝试删除node_modules文件夹,然后再次运行npm install。
如果它不起作用,请尝试将以下内容添加到tsconfig.json中(这是较早版本针对新的角度编译器版本的解决方法)
"include": [
"src/**/*",
"node_modules/ng2-animate-on-scroll/index.ts",
"node_modules/ng2-animate-on-scroll/**/*.ts"
]