Code won't run on my local server

ok, i’m almost 100% that the problem is in your

<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="script.js"></script>

your path must be relative… you can try something like this, but I’m not sure if that will work…

<link rel="stylesheet" href="./style.css">
<script type="text/javascript" src="./script.js"></script>

I’ve used the current format for all my projects. This is the only one that doesn’t work. And it still doesn’t work even after the change

i don’t know man… i tried my best… try to click on those style.css and script.js links and see what shows up.

Thanks for trying. By the way I tried it on nodejs server and it still didn’t work. I guess I’ll have to find another way to make it work or just code the project on codepen.

no it’s definitely on port 3000, because you can see that text ‘Vacation coverage in Europe’, but it seems to me it can’t find your style.css and script.js files… in dev tools’ elements tab, inside the header try to click on those 2 links and watch what shows up… At least, I would start debugging from there…

You are right, it can’t find them for some reason. I decided to put the css and javascript in the html code and skip the links so I could see what would happen. It works!. I’m not sure what the problem is then, I guess I’ll just not use the style.css and script.js documents.

yeah, i had the same problem in one of my previous projects… the problem is that you were providing absolute path and your server was looking at the wrong place for those files… you can use those files, but then you need to figure out what the right url would be for them so that your server file can find them… if you are using node, take a look at it’s built-in module called path…

I think I’ll focus on finishing the project then work out how to link to those files. Thank you so much for helping me.

1 Like

no problem man :smiley: :+1: glad if i could help… :smiley:

1 Like