close

[Solved] JS file gets a net::ERR_ABORTED 404 (Not Found)

Today We are Going To Solve JS file gets a net::ERR_ABORTED 404 (Not Found) in Javascript. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix JS file gets a net::ERR_ABORTED 404 (Not Found) Error?

  1. How to Fix JS file gets a net::ERR_ABORTED 404 (Not Found) Error?

    To Fix JS file gets a net::ERR_ABORTED 404 (Not Found) Error just Put your static files. First of all Put all your “static” files in a folder dedicated to it, different from where you put your “views” then add this line in your server code: app.use("/static", express.static('./static/')); And this will serve every file in your “static” folder via the /static route. Querying your index.js file in the client thus becomes just like below. And by doing this you will solve your error. <script src="static/index.js"></script> I hope this will help you.

  2. JS file gets a net::ERR_ABORTED 404 (Not Found)

    To Fix JS file gets a net::ERR_ABORTED 404 (Not Found) Error just Put your static files. First of all Put all your “static” files in a folder dedicated to it, different from where you put your “views” then add this line in your server code: app.use("/static", express.static('./static/')); And this will serve every file in your “static” folder via the /static route. Querying your index.js file in the client thus becomes just like below. And by doing this you will solve your error. <script src="static/index.js"></script> I hope this will help you.

Solution 1 : Put your static files

First of all Put all your “static” files in a folder dedicated to it, different from where you put your “views” then add this line in your server code:

app.use("/static", express.static('./static/'));

And this will serve every file in your “static” folder via the /static route. Querying your index.js file in the client thus becomes just like below. And by doing this you will solve your error.

<script src="static/index.js"></script>

I hope this will help you.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

Leave a Comment