Css 细长加载条错误-找不到模块'@角度/核心';

Css 细长加载条错误-找不到模块'@角度/核心';,css,angular,typescript,Css,Angular,Typescript,我现在正在学习Angular,我正在尝试使用ng2细长加载条,但我遇到了这个错误- ERROR in ../node_modules/ng2-slim-loading-bar/index.d.ts(1,37): error TS2307: Cannot find module '@angular/core'. ../node_modules/ng2-slim-loading-bar/src/slim-loading-bar.component.d.ts(1,24): error TS2307:

我现在正在学习Angular,我正在尝试使用
ng2细长加载条
,但我遇到了这个错误-

ERROR in ../node_modules/ng2-slim-loading-bar/index.d.ts(1,37): error TS2307: Cannot find module '@angular/core'.
../node_modules/ng2-slim-loading-bar/src/slim-loading-bar.component.d.ts(1,24): error TS2307: Cannot find module '@angular/core'.
../node_modules/ng2-slim-loading-bar/src/slim-loading-bar.service.d.ts(1,28): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in ./src/styles.css (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./src/styles.css)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Failed to find '../node_modules/ng2-slim-loading-bar/style.css'
  in [
    /Users/richardwood/Development/Inmate_Intake_App/inmate-intake-app/src
  ]
    at resolveModule.catch.catch (/Users/richardwood/Development/Inmate_Intake_App/inmate-intake-app/node_modules/postcss-import/lib/resolve-id.js:35:13).
我显然错过了什么

我用的是角度8。 我用-
npm安装ng2细长加载条——保存

我还使用了
npm安装rxjs compat--save

然后,我将SlimLoadingBarModule导入到app.module.ts文件中-

import { InmateEditComponent } from './inmate-edit/inmate-edit.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ReactiveFormsModule } from '@angular/forms'; 
import { SlimLoadingBarModule } from 'ng2-slim-loading-bar';

@NgModule({
  declarations: [
    AppComponent,
    InmateAddComponent,
    InmateGetComponent,
    InmateEditComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    ReactiveFormsModule,
    SlimLoadingBarModule 
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
然后在src>>styles.css文件中包含了随库提供的样式-

@import./node_modules/ng2 slim加载条/style.css”

然后在app.component.ts中-

import { Component } from '@angular/core';
import { SlimLoadingBarService } from 'ng2-slim-loading-bar';
import { NavigationCancel,  
  Event,  
         NavigationEnd,  
         NavigationError,  
         NavigationStart,  
         Router } from '@angular/router'; 


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  title = 'inmate-intake-app';

  constructor(private loadingBar: SlimLoadingBarService, private router: Router) {  
    this.router.events.subscribe((event: Event) => {  
      this.navigationInterceptor(event);  
    });  
  }  

  private navigationInterceptor(event: Event): void {  
    if (event instanceof NavigationStart) {  
      this.loadingBar.start();  
    }  
    if (event instanceof NavigationEnd) {  
      this.loadingBar.complete();  
    }  
    if (event instanceof NavigationCancel) {  
      this.loadingBar.stop();  
    }  
    if (event instanceof NavigationError) {  
      this.loadingBar.stop();  
    }  
  } 
}

如果可能的话,我们将非常感谢您的帮助或建议。

尝试在您的客户端上安装npm


它将安装所有缺失的模块

嘿,莫耶·安托尼亚,谢谢你的建议。我尝试了此操作,但仍收到错误消息:(