How to fix nodemon app crash after added mongoose

I am setting up an environment with mongodb, node.js, express.js and mongoose. mongoDB is in its own container, and the same with the rest.

It all worked fine until I tried to add mongoose.

After this line was added

const mongoose = require("mongoose");

I got an error-message when a ran docker-compose up


This is my package.json


This is my dockerfile for the api

Does anyone knwo how to fix this?

Source: StackOverflow