Estou tendo este erro quando tento rodar o servidor...
[nodemon] starting `node server.js`
node:internal/modules/esm/resolve:854
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mongoose' imported from C:\Users\matsc\OneDrive\Documentos\Cursos\Alura\Lógica de Programação\node-criando-uma-API-Rest\src\config\dbConnect.js
at packageResolve (node:internal/modules/esm/resolve:854:9)
at moduleResolve (node:internal/modules/esm/resolve:927:18)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
at link (node:internal/modules/esm/module_job:95:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v20.17.0
[nodemon] app crashed - waiting for file changes before starting...
Meu arquivo "dbConnect.js" está da seguinte forma:
import mongoose, { mongo } from "mongoose";
async function conectaNaDatabase() {
mongoose.connect(process.env.DB_CONNECTION_STRING);
return mongoose.connection;
};
export default conectaNaDatabase;
Alguém consegue me ajudar?