simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

huangapple go评论52阅读模式
英文:

simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

问题

<pre> 标签内的内容是英文,不需要翻译。

下面是你尝试的安装命令和 package.json 中的部分内容:

"dependencies": {
    "@angular/animations": "^14.2.0",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "rxjs": "~7.5.0",
    "simplebar-angular": "^3.2.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
}

在添加了 simplebar-angular 后,你在 app.module.ts 中导入了它:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SimplebarAngularModule } from 'simplebar-angular';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    SimplebarAngularModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

请检查以下错误图片。

你还尝试了清除缓存,但仍然面临相同的错误。希望这些信息对你有所帮助。

英文:

<pre>
<p><b>simplebar-angular</b> is not working, <b>Error</b>: Cannot find module 'simplebar-angular' or its corresponding type declarations | Angular </p>
</pre>

install command I've tried as below

npm i simplebar-angular
yarn add simplebar-angular

it's added after installation in the package.json as below,

&quot;dependencies&quot;: {
    &quot;@angular/animations&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/common&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/compiler&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/core&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/forms&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/platform-browser&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/platform-browser-dynamic&quot;: &quot;^14.2.0&quot;,
    &quot;@angular/router&quot;: &quot;^14.2.0&quot;,
    &quot;rxjs&quot;: &quot;~7.5.0&quot;,   
    &quot;simplebar-angular&quot;: &quot;^3.2.0&quot;,
    &quot;tslib&quot;: &quot;^2.3.0&quot;,
    &quot;zone.js&quot;: &quot;~0.11.4&quot;
  }

after adding the package I'm importing it to app.module.ts as below,

import { NgModule } from &#39;@angular/core&#39;;
import { BrowserModule } from &#39;@angular/platform-browser&#39;;
import { AppRoutingModule } from &#39;./app-routing.module&#39;;
import { AppComponent } from &#39;./app.component&#39;;
import { SimplebarAngularModule } from &#39;simplebar-angular&#39;;

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    SimplebarAngularModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

please check the below error images,

simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

simplebar-angular is not working, Error: Cannot find module 'simplebar-angular' or its corresponding type declarations | Anguler

I've also tried all the steps after the clean catch as below,

npm cache clean --force

but still facing the same error,
please help, thank you!

答案1

得分: 1

你还应该安装simplebar-angular的依赖项。在你的情况下,你需要安装simplebar-core 链接在这里。你可以查看这个stackblitz 链接在这里。你可以将你的依赖项与这个实时示例进行比较。希望这能够正常工作。

英文:

You should also install the dependencies for simplebar-angular. In your case you need to install simplebar-core Link is here . You can check this stackblitz Link is here. You can compare your dependencies with this live example. Hopefully this should work.

huangapple
  • 本文由 发表于 2023年2月8日 16:07:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75382848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定