Information Security with HelmetJS - Install and Require Helmet

Tell us what’s happening:
I added this line:
const package.json = require(“helmet”);
to myApp.js and am getting this:
Error: helmet version 3.21.3 should be in package.json
I’ve read every answer on the forum. Nothing works.
What am i missing?

Your project link(s)

solution: boilerplate-infosec - Replit

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36

Challenge: Information Security with HelmetJS - Install and Require Helmet

Link to the challenge:

Did you read this?

Yes.
const helmet = require(‘helmet’);
Is that not correct?

It is, and your Replit is passing the tests for me now.

It’s passing for me now too. After getting the error: helmet version 3.21.3 should be in package.json repeatedly. Then it passed after i changed nothing. Hard to learn when there’s a glitch in the educational software.

And before anyone points it out, i am aware my original code was wrong. I figured it out and still got the same error repeatedly.

So for anyone stuck on this, as long as you have const helmet = require(‘helmet’); on the third line of myApp.js, you are correct. All you can do is keep submitting the same correct answer and hope to not get an error at some point.

The only explanation I can think of is you didn’t restart the server after the code change. Maybe you did it later without realizing it (or use the save hotkey which should also restart the server but I don’t really trust Replit on that, so I always just stop and start the server to be safe).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.