英文:
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,
"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"
}
after adding the package I'm importing it to app.module.ts as below,
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 { }
please check the below error images,
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论