Having trouble locating a module in Node.js Express
Sample code provided below
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Error encountered in the command prompt
C:\Users\user\Desktop\project>npm express -v
7.5.3
C:\Users\user\Desktop\project>npm utils -v
7.5.3
C:\Users\user\Desktop\project>node server
node:internal/modules/cjs/loader:928
throw err;
^
Error: Unable to locate module './utils'
Require stack:
- C:\Users\user\Desktop\project\node_modules\qs\lib\stringify.js
- C:\Users\user\Desktop\project\node_modules\qs\lib\index.js
- C:\Users\user\Desktop\project\node_modules\express\lib\middleware\query.js
- C:\Users\user\Desktop\project\node_modules\express\lib\application.js
- C:\Users\user\Desktop\project\node_modules\express\lib\express.js
- C:\Users\user\Desktop\project\node_modules\express\index.js
- C:\Users\user\Desktop\project\server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Desktop\project\node_modules\qs\lib\stringify.js:3:13)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\user\\Desktop\\project\\node_modules\\qs\\lib\\stringify.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\qs\\lib\\index.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\middleware\\query.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\application.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\express.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\index.js',
'C:\\Users\\user\\Desktop\\project\\server.js'
]
}