'Nodemon comes back with errors when I attempt to start it in Terminal

I was working on this project yesterday and everything was fine but when I went on to continue today I was unable to run nodemon to view my code.

Normally I go to the terminal and type 'npm start' then it does its boot stuff then opens in localhost.

But today when I did that same step it came back with some error code and I can't figure out why.

Below are the errors that showed after my attempt the start nodemon.

PS F:\Mircrosoft Code Projects\Shopping Cart Backend> npm start

> [email protected] start
> node server.js

F:\Mircrosoft Code Projects\Shopping Cart Backend\node_modules\express\lib\router\route.js:203
        throw new Error(msg);
        ^

Error: Route.get() requires a callback function but got a [object Undefined]
    at Route.<computed> [as get] (F:\Mircrosoft Code Projects\Shopping Cart Backend\node_modules\express\lib\router\route.js:203:15)
    at Function.proto.<computed> [as get] (F:\Mircrosoft Code Projects\Shopping Cart Backend\node_modules\express\lib\router\index.js:516:19)
    at Object.<anonymous> (F:\Mircrosoft Code Projects\Shopping Cart Backend\routes\pages.js:17:8)  
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (F:\Mircrosoft Code Projects\Shopping Cart Backend\server.js:12:14)

I have no clue what is wrong and was hoping someone else has experienced and resolved this issue. Thank you in advance

Edit:

HEre is some code. this came from my server.js which is the file that gets run when using 'npm start'

const express = require('express');
const path = require('path');

const app = express();

const publicDirectory = path.join(__dirname, './public');
app.use(express.static(publicDirectory));

app.set('view engine', 'hbs');


app.use('/', require('./routes/pages'));
app.use('/products', require('./routes/products'));

app.listen(5000, () => {
    console.log("Server is running or port 5000");
})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source