Information Security with HelmetJS - Install and Require Helmet

What’s happening:

for challenge Install and Require Helmet

I have picked the first option to run this project:

Clone this GitHub repo and complete these challenges locally.

by using VS Code with Live server on localhost.

Solution Link

was http://localhost:[port]

Test Passing

I tried to pass the test with the following result

// running tests
helmet version 3.21.3 should be in package.json
// tests completed
// console output [Error]

Question

I have no idea what console it requests.
also is it important what browser settings I have to pass that test?

show the content of your package.json file, as that is what the test has issues with

Sorry I do not understand if it is possible to attach a whole file here.
So I copied the text from it

By the way, I have just copied repository bн git from repository provided by freecodecamp.

package.json

{
	"name": "fcc-infosec-challenges",
	"version": "0.0.1",
	"description": "fcc backend boilerplate",
	"main": "server.js",
	"scripts": {
		"start": "node myApp.js"
	},
	"dependencies": {
		"express": "^4.14.0",
		"helmet": "3.21.3"
	},
	"keywords": [
		"node",
		"hyperdev",
		"express",
		"freecodecamp"
	],
	"license": "MIT"
}

Additional question

Also I got a question.
what directory should be selected as a root one? for web server.
I picked “views” is it right? I have tried to select main directory of repository as root web folder with the same result

I hope you will help me to deal with this problem and this ticket will not be closed automatically because of idling.
Because I do not understand what console your system is trying to use (and fail) and how to check accessibility of that console.

You can’t use Live Server, it is a Node.js app. It should be started using Node.

npm run start from the terminal inside the project root folder (you have to have Node.js installed)

Thank you for the answer.
I have installed last LTS node.js and have ran the project (it started on port 3000).
But I still have the same issue about console output

and again silence.
Can anyone answer my question?

Did you require in?

so require it as helmet in myApp.js .

Also, make sure you submit http://localhost:3000


Without seeing your code, we can’t really help. If you want to complete this locally and need help with your code, you should create a repo for it on GitHub.

I have just copied it from your git rep.
I did not make any changes there.
But if you still need I can attach my data here.

and yes, everything meets the started requirements (have helmet and server link).

P.S
at my first post, I asked about browser setting (blocking or restricting to use cross-sites or third party stuff) but I have got no answer to that question yet.

We need to see your code. Please create a repo for it on GitHub.

Ok. Here you go my repository

You didn’t require in helmet inside myApp.js. Look at how express is required in, you need to do the same for Helmet.

possibly but I followed the requirements published on the task.

Shoudl I delete it?

Cloning the repo doesn’t add any required values, you have to do that.

It is asking you to require in helment. Use the same syntax as you can see for how express is required in.

const somePackageName = require('somePackageName');

Ok, thank you for the information.

It was no obvious to me.

I will update info.

done. I hope I did it in the right way :slight_smile:

But but the problem remains.

You removed the express dependency from package.json, you can’t run the express server without express. Put it back and install the dependencies again.

https://github.com/freeCodeCamp/boilerplate-infosec/blob/main/package.json

Now run the server using the start script npm start and submit http://localhost:3000

Your code should pass.


If running this locally keeps giving you issues, I would suggest you use the Gitpod starter, and don’t make changes to the boilerplate code you are not asked to make.

that dependency was deleted because I had to reinstall express package (I cannot run server). and that dependency left on package-lock.json.

If running this locally keeps giving you issues, I would suggest you use the Gitpod starter,…

Does it mean that none of browser settings could cause this issue?

You can’t use Live Server; it is a Node.js application. To start it, you need to use Node.js.

Run the following command from the terminal inside the project root folder (ensure Node.js is installed):

npm run start

So far, nothing points to an external issue. You simply have not followed the requirements.