Error TS2307: Cannot find module ‘@adminjs/mongoose’ or its corresponding type declarations. Error integrating mongoose database with AdminJS

Good day, I am trying to integrate a mongoose database into my AdminJS project using Express.js. I have imported all the necessary packages, but when I run the server, I get an error saying that the module @adminjs/mongoose cannot be found. I’m not sure if it’s a compatibility issue, but I have tried uninstalling and reinstalling the package multiple times, and the error persists. If anyone can help me resolve this issue, I would greatly appreciate it. Below is the project code and the error messages:

Main file (app.ts):
(The Mongoose URL is stored in a .env file):

import express from 'express';
import AdminJS from 'adminjs';
import AdminJSExpress from '@adminjs/express';
import mongoose from 'mongoose';
import * as AdminJSMongoose from '@adminjs/mongoose';
import * as dotenv from 'dotenv';
import { PersonModel } from './models/personModel.js';
dotenv.config();

const port = process.env.PORT || 3000;

AdminJS.registerAdapter({ 
    Resource: AdminJSMongoose.Resource,
    Database: AdminJSMongoose.Database,
});

const start = async (): Promise<void> => {
  const app = express();

  await mongoose.connect(`${process.env.MONGO_URL}`);

  const admin = new AdminJS({
    resources: [
      {
        resource: PersonModel
      }
    ]
  });

  const adminRouter = AdminJSExpress.buildRouter(admin);

  app.use(admin.options.rootPath, adminRouter);

  console.log(`Starting server on port ${port}`);
  app.listen(port, () => {
    console.log(`AdminJS available at http://localhost:${port}${admin.options.rootPath}`);
  });
};

start();

Model schema file:

import { model, Schema } from 'mongoose';

export interface Person {
    name: string;
    age: number
};

export const PersonSchema = new Schema<Person>({
    name: { type: String, required: true },
    age: { type: Number, required: true }
});

export const PersonModel = model<Person>('Person', PersonSchema);

package.json showing the installed packages:

{
  "name": "admin_wellfit",
  "version": "1.0.0",
  "description": "admin for wellfit project",
  "main": "./app.ts",
  "author": "OF",
  "license": "MIT",
  "devDependencies": {
    "@types/express": "^5.0.0",
    "ts-node": "^10.9.2",
    "tslib": "^2.7.0",
    "typescript": "^5.6.2"
  },
  "dependencies": {
    "@adminjs/express": "^6.1.0",
    "@adminjs/mongoose": "^3.0.1",
    "adminjs": "^7.8.13",
    "dotenv": "^16.4.5",
    "express": "^4.21.0",
    "express-formidable": "^1.2.0",
    "express-session": "^1.18.0",
    "mongoose": "^8.6.3"
  },
  "scripts": {
    "dev": "ts-node app.ts"
  }
}

Error message when running the server:

TSError: ⨯ Unable to compile TypeScript:
app.ts:5:34 - error TS2307: Cannot find module '@adminjs/mongoose' or its corresponding type declarations.

import * as AdminJSMongoose from '@adminjs/mongoose';

error screenshot

I tried to install and import the @adminjs/mongoose package into my AdminJS project, as per the documentation, to integrate a Mongoose database with AdminJS. I expected the module to be recognized and allow me to register the Mongoose adapter in AdminJS, but instead, I got a TypeScript error indicating that the module couldn’t be found or its type declarations were missing. I tried reinstalling the package multiple times, but the issue persists.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật