You need to be a little careful with blindly running npm audit fix as it may update dependencies that need to stay at the version in the boilerplate. But in this case, I don’t think it matters.
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1897:16)
at listenInCluster (node:net:1945:12)
at Server.listen (node:net:2037:7)
at Function.listen (/workspace/boilerplate-infosec/node_modules/express/lib/application.js:618:24)
at Object. (/workspace/boilerplate-infosec/myApp.js:63:5)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
Emitted ‘error’ event on Server instance at:
at emitErrorNT (node:net:1924:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: ‘EADDRINUSE’,
errno: -98,
syscall: ‘listen’,
address: ‘::’,
port: 3000
}
ReferenceError: helmet is not defined
at Object. (/workspace/boilerplate-infosec/myApp.js:3:9)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
Node.js v20.12.2
and this error when just like add app.use(helmet.hidePoweredBy()); under the second instructions.
The first is because you didn’t stop the server before starting it again, and for the second it sounds like you didn’t require in helmet (which you did do in your original code in the image).
If you need more help, post a GitHub repo or share a snapshot of your Gitpod workspace.