Managing Packages with NPM - How to Pass Tests Without Replit?

The FCC NPM instructions say that you can use Replit or you can use your own local machine and host a public URL. I opted for the second option so I can get more github and other practical experience, but I can’t figure out how to make the first test pass without a Replit link.

The task itself is just adding an author to the package.json, which is super simple so I know I’m not messing that part up.

I forked the repository and hosted the app on github pages here: boilerplate-npm | A boilerplate for the freeCodeCamp curriculum.

And when I post that url (with the app running as far as I’m aware) it doesn’t pass the test.

Here’s the link to the repository in case it’s helpful: GitHub - HexagonBen/boilerplate-npm: A boilerplate for the freeCodeCamp curriculum.

I’d prefer to do this section locally instead of on Replit, but what exactly do I need to plug into that input field to get it to recognize my package.json?

Is github pages a no-go? Do I need a different hosting service?

I’ll use Replit if I really have to but I need practice with Git and actually hosting my own stuff so I’d prefer not to lean on Replit unless I really have to.

solution: boilerplate-npm | A boilerplate for the freeCodeCamp curriculum.

Your browser information:

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

Challenge: Managing Packages with NPM - How to Use package.json, the Core of Any Node.js Project or npm Package

Link to the challenge:

A basic webpage host can’t run a Node.js application, for that you need a webserver with properly installed packages for the application. This would have to be a service, like Replit, Heroku, AWS, or others that can host applications, not just websites. It’s also possible if you have a static IP from your webprovider to run a server from your computer to serve up your application… but that would take a bit of work on your end.

I’ve done projects locally, and uploaded them to Replit after they were finished… I also wanted to learn Github, so started using that with my local VSCode implementation, and heard that Heroku could import and host your page directly from Github, but I guess they disabled the direct import feature for security reasons. Got it to work, but had to manually upload my files to Heroku.

That makes sense. Thanks! While you’re around, I don’t suppose you know how to get a live app link on Replit? I’ve been googling for a while now (since before I posted this thread) trying to get Replit to give me a live app link but I can’t figure it out.

I don’t need to “publish” do I? I tried publishing and got as far as the part where it wanted me to upload a cover picture and I figured that probably wasn’t what I needed to do just to get a live app link.

There’s a lot of threads on the forum that talk about getting a live app link on Replit; I found one where Sky020 even gave a picture:

Here’s the post: How to submit to Freecodecamp?

But I’m still failing to figure out how to get a live app link on Replit…

I can’t find that miniature browser that Sky020 was talking about when I hit the run button. It just throws a bunch of errors when I run it.

Here’s the link: boilerplate-npm - Replit

So when working in Replit, it should look like this, with files on the left, the file you’re editing in the middle, and a previewer on the right.

Now you can edit your code, but when you want to test/run it, you can hit the Run button I’ve circled at the top. When you do that, it should run your code, and on the right it should show a preview of your page, with that live link at the top, and the console at the bottom. While running you should also be able to pop that live link into a web browser and also see your page. If an error occurs it will stop your program, or you can click the stop bottom at the top to stop it.

Do you not see that?

Nope. When I run it just throws a bunch of errors. There’s an editor pane, and a console/shell pane on the right (no preview pane).

Looks like this:

maybe you forgot a comma after “author”: “Ben Mason”?

lol I’m a moron. Fixed it. Still no url link though:

1 Like

You have to install express module.
In the shell you type npm i express i think?

1 Like

That worked thanks!

I’m surprised they didn’t put that in the instructions.

Yeah, you’re not going to see a live-link until you can get your code to run without errors.

Quick question, did you create a blank Replit and import your files from Github, or did you use the link in the challenge to have it automatically create a Replit for you?

The only reason I ask is because I believe Replit should have installed all dependencies automatically… but if you created a blank replit rather than having it create one for you, that option might not be enabled.

I used the link and had it automatically create the Replit for me. I didn’t start with a blank one.

Weird… I’ve never messed with Replit much outside of the course load, but typically, the first time you hit the Run button, Replit automatically installed any dependencies listed before attempting to run the code… maybe it was because your package.json originally had a syntax error that it didn’t do that… Working on my home PC, yeah, I have to manually install any required packages into my Node.JS inviroment, but Replit has always done that automatically for me.

1 Like

I just had the exact same problem when I moved on to the “Basic Node & Express” section. I had to run npm i express in the shell again to get things running, even though I used the Replit starter project link provided in the curriculum.

You can run and submit the backend challenges from your local setup.
It’s what I’m doing at the moment for the Quality Assurance challenges.

But your code has to be hosted somewhere public to submit the projects.

Instructions for setting up and submitting the challenges locally:

1 Like

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