I kind of new to node.js
when i run local server with index.js located one directory up from index.htmlthe browser gives me this error:
when i run the server with index.js in the same directory or in a sub folder directory it works fine.
but i when i run it as live server it works both ways.
I tried moving it to different folders and changing the name.
2
Answers
I’m not sure, but in the first picture index.js seems two directories higher than index.html. Maybe try ‘../../index.js’.
Hi there I found it @Vladislav Bykanov It is because
index.html
and app.js or in your caseindex.js
should be on the same level of hierarchy i.eSuch as in the given image… Here
js file
andHTML file
are on same level… App.js is now as/app.js
only… it is not../public/app.js
I am suggesting you not to put
index.html
in public and put it in the normal../index.html
so that it doesn’t confuse you…