Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我正在使用angular创建web API,但不幸的是我面临这个问题,所以请任何人指导我解决这个问题_Angular_Angular Httpclient - Fatal编程技术网

我正在使用angular创建web API,但不幸的是我面临这个问题,所以请任何人指导我解决这个问题

我正在使用angular创建web API,但不幸的是我面临这个问题,所以请任何人指导我解决这个问题,angular,angular-httpclient,Angular,Angular Httpclient,当我在导入区域输入HttpClientModule时,将显示此错误。如果我删除HttpClientModule,则此错误将消失。如何解决此错误请指导我。谢谢。我也遇到过同样的问题。我不知道你在项目中使用的是哪个版本的Angular 我只是通过运行以下命令将Angular CLI更新为最新版本: ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule

当我在导入区域输入HttpClientModule时,将显示此错误。如果我删除HttpClientModule,则此错误将消失。如何解决此错误请指导我。谢谢。

我也遇到过同样的问题。我不知道你在项目中使用的是哪个版本的Angular

我只是通过运行以下命令将Angular CLI更新为最新版本:

 ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 
- error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

2801 export declare class HttpClientModule 

while my code is 
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { AppComponent } from './app.component';
import { BankAccountComponent } from './bank-account/bank-account.component';
import { HttpClientModule } from '@angular/common/http';

@NgModule({
declarations: [
AppComponent,
BankAccountComponent
],
imports: [
BrowserModule,
FormsModule, 
ReactiveFormsModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
然后我创建了一个新项目,并将所有文件移到此处进行构建,现在HttpClientModule上没有错误。

这是一个奇怪的错误,我突然发现,现在已经不见了。

什么是导出声明类HttpClientModules如果我是初学者,我无法理解你的问题,请你活着解释一下好吗?你可以分别发布错误和原始代码吗?确保所有@angular包都固定在同一版本。当您有不同版本的angular软件包时,通常会发生此错误
npm update angular-cli -g