Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Bug] ERR_MODULE_NOT_FOUND

Boa noite, pessoal!

Tudo bem?

Após alguns testes, ao utilizar o NPM Run Dev aparece este código no terminal:

npm run dev

> 3266-express-mongo@1.0.0 dev
> nodemon server.js

[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node server.js`
node:internal/modules/esm/resolve:263
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\arthu\OneDrive\Documentos\EnviromentProduction\Nodejs-API-Rest-Express-MongoDB\src\config\dbConnect.js' imported from C:\Users\arthu\OneDrive\Documentos\EnviromentProduction\Nodejs-API-Rest-Express-MongoDB\src\app.js
    at finalizeResolution (node:internal/modules/esm/resolve:263:11)
    at moduleResolve (node:internal/modules/esm/resolve:908:10)
    at defaultResolve (node:internal/modules/esm/resolve:1131:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///C:/Users/arthu/OneDrive/Documentos/EnviromentProduction/Nodejs-API-Rest-Express-MongoDB/src/config/dbConnect.js'
}

Node.js v21.6.2
[nodemon] app crashed - waiting for file changes before starting...

Boa noite!

1 resposta
solução!

Pessoal, eu vi que estava usando import conectaNaDatabase from "./config/dbConnect.js";

E a solução foi remover este config e a conexão voltou a ser feita normalmente.