I recently built a project from scratch : Angular 18 app (SSR). The project includes some libraries imported from another more achieve project (copy pasting the package.json).
I set up my application (in server.ts), performing then
ng build
and finally a
nodemon dist/<projectname>/server/server.mjs
to rend the app on localhost.My app got crashed every time i tried to render my server.mjs with the following result :
TypeError: Cannot convert undefined or null to object at Function.getPrototypeOf (<anonymous>) at file:///C:../server/server.mjs:107:202540 at file:///C:../server/chunk-GUTDEJWW.mjs:2:1056 at ...
I figured out that the problem came from the following line of code :
const mongoose = require('mongoose');
Node version : 20.12.2
mongoose version 8.4.4
I tried to retrograt mongoose to 6.8.4 (as my old project) but the problem persists.
If someone knows why mongoose 8 is not compatible with my Angular 18 or if knows something, i would like to hear it.