Information Security with HelmetJS - Hide Potentially Dangerous Information Using helmet.hidePoweredBy()

Tell us what’s happening:

it won’t go through … whyyyyy??? can u please check my code

###Your project link(s)

solution: https://3000-freecodecam-boilerplate-g7z9w6r9kdw.ws-us110.gitpod.io

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0

Challenge Information:

Information Security with HelmetJS - Hide Potentially Dan


gerous Information Using helmet.hidePoweredBy()

Remember to restart the server.

Ctrl + C then npm start in the terminal.


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.

gitpod /workspace/boilerplate-infosec (main) $ npm start

fcc-infosec-challenges@0.0.1 start
node myApp.js

node:events:496
throw er; // Unhandled ‘error’ event
^

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
}

Node.js v20.12.2

is giving me that error when i npm start

gitpod /workspace/boilerplate-infosec (main) $ npm start

fcc-infosec-challenges@0.0.1 start
node myApp.js

/workspace/boilerplate-infosec/myApp.js:3
app.use(helmet.hidePoweredBy());
^

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.

That is two new and different errors.

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.