How do you run Docusaurus on Replit?

I have been able to get virtually anything running on Replit and love this platform. However, for the life of me, I cannot get Docusaurus to run. I followed the tutorial here: Installation | Docusaurus and I have all the files set up. When I run “npm run start” the Replit just says: " Make sure this Repl has a port open and is ready to receive HTTP traffic." What the heck does that mean? I have searched this question all over Replit and nobody has any answer. Replit doesn’t run on the localhost, so what is going on here? Docusaurus can work on port 8080 or 3000, but no matter what I dod, I can’t view anything as the Replit complains there is no port open?

code snippet

Hi @ddsgadget , welcome to the forums!
Is the port configuration in the Network tab correct? Like the host?

When you run a repl, you need to bind it to 0.0.0.0 instead of localhost. Replit also has a docusaurus template (but might be slightly modified). Try using that, or fix your bind host.

thanks for the quick reply. But I have no idea what that even means. i have no network tab and no configuration port anywhere in Replit. I have never had this issue with any Replit. I install the code, put the correct run command in the Replit file and it works. Docusaurus won’t run.

how do you bind it? I tried using the Replit template, but it just throws an error. Says to report the issue. Actually, nonoe of the community docussaurus templates work.

I believe that’s related to the ongoing issue, here:

Appreciate the quick answers here, but i don’t understand them at all?

  1. “you need to bind it to 0.0.0.0 instead of localhost.” how do you bind it? What does that even mean? I don’t see anywhere in Replit about binding and I have never done this before, so not sure what that means.
  2. “Is the port configuration in the Network tab correct? Like the host?” I have no Network tab in Replit and no place that has anything with port configuration. I searched all the tabs and there is nothing about this.

When a computer wants to recieve network requests (such as HTTP requests), you need to tell the OS where you want to be listening for data. That is called binding. For example, you could bind to localhost:3000, meaning whenever data arrives at “localhost” on port 3000, then the OS will forward that data to the listening program. Here, 0.0.0.0 is special, since it tells the OS that data arriving on all interfaces on port 3000 should be forwarded.

As for the network tab, I also have not seen a network tab yet.

1 Like

But Replit doesn’t run on locahost. It has it’s own URL. I can’t bind the URL at Replit. There is nothing running on my local machine. It is running on Replit.

May be an Explorer thing.
@ddsgadget :
When running your websever in your code (like app.run or something similar), the host should be set to 0.0.0.0, and the port can be just 8080.

There is no such code in docusaurus where you can set the host. This doesn’t exist. Is this set in the Replit config files? If so where? I don’t see it.

OK, so the solution, after I read everything above, I played around for Docusaurus is that your Replit file, needs the following run command (assuming you are using Yarn)

run = "yarn start --port 8080 --host 0.0.0.0"

if you use npm, i suppose it should be:

run = "npm run start -- --port 8080 --host 0.0.0.0"

(npm requires an additional – for some reason)

Hope this helps someone else.

3 Likes

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