angular CLI中获取生成错误:无法重新声明块作用域变量';ngDevMode';
我的angular应用程序中出现了奇怪的构建错误。谁能指出我哪里做错了。我正在尝试使用ADAL.js包集成Azure AD身份验证。我正在为此使用angular CLI中获取生成错误:无法重新声明块作用域变量';ngDevMode';,angular,typescript,angular-cli,Angular,Typescript,Angular Cli,我的angular应用程序中出现了奇怪的构建错误。谁能指出我哪里做错了。我正在尝试使用ADAL.js包集成Azure AD身份验证。我正在为此使用adal-angular5 cli命令:ng serve node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11)中出错:错误TS2451:无法重新声明块作用域变量“ngDevMode”。 node_modules/adal-angular5/node_modules/@angular/
adal-angular5
cli命令:ng serve
node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11)中出错:错误TS2451:无法重新声明块作用域变量“ngDevMode”。
node_modules/adal-angular5/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11):错误TS2451:无法重新声明块作用域变量“ngDevMode”
与ng build--prod一起使用时
@angular\common\http\http.ts(62,2)中出错:“HttpClient”的模板编译期间出错
函数调用在decorators中不受支持,但在“Injectable”中调用了“makeDecorator”
“可注入”调用“ɵmakeDecorator”。
node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11):错误TS2451:无法重新声明块作用域变量“ngDevMode”。
node_modules/adal-angular5/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11):错误TS2451:无法重新声明块作用域变量“ngDevMode”
这里是我的角度版本的细节
Angular CLI: 6.1.4
Node: 8.11.4
OS: win32 x64
Angular: 6.1.3
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.4
@angular-devkit/build-angular 0.7.4
@angular-devkit/build-optimizer 0.7.4
@angular-devkit/build-webpack 0.7.4
@angular-devkit/core 0.7.4
@angular-devkit/schematics 0.7.4
@angular/cli 6.1.4
@ngtools/webpack 6.1.4
@schematics/angular 0.7.4
@schematics/update 0.7.4
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
我的app.moudle.ts供参考:
import { AuthService } from './services/auth.service';
import { AuthGuardService } from './services/auth-gurad.service';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { ProtectedComponent } from './protected/protected.component';
import { AuthCallbackComponent } from './auth-callback/auth-
callback.component';
import { Adal5Service, Adal5HTTPService } from 'adal-angular5';
import { HttpClient } from '@angular/common/http';
const routes: Routes = [
{
path:'',
children: []
},
{
path:'protected',
component:ProtectedComponent,
canActivate: [AuthGuardService]
},
{
path:'auth-callback',
component:AuthCallbackComponent
}
];
@NgModule({
declarations: [
AppComponent,
ProtectedComponent,
AuthCallbackComponent
],
imports: [
BrowserModule,
RouterModule.forRoot(routes)
],
exports: [RouterModule],
providers: [AuthGuardService, AuthService, Adal5Service,{
provide:Adal5HTTPService, useFactory:Adal5HTTPService.factory, deps:
[HttpClient, Adal5Service] } ],
bootstrap: [AppComponent]
})
export class AppModule { }
这是我的tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
如果需要更多的参考资料,请告诉我。看起来您正试图在项目中使用Angular 6,但adal-angular5
取决于Angular 5。因此,安装了Angular 5和Angular 6,并且它们的类型定义相互冲突;您可能在运行时也有问题。请将您的项目切换到Angular 5,或者尝试一下,该项目应该支持Angular 4及更新版本。请发布您的tsconfig.json。我已经更新了详细信息。如果有什么问题,请告诉我。