Require my file


Sorry for the translation of messages through a translator.
I’m doing a project on the node js and I am not to understand how the system works because the models which code works on my laptop not working on your servese to unwritten much text, I strip off picture.


Hi Artamonov,

From the screenshot it looks like the server.js file is not saved. Can you try saving it first and then run everything again?



I agree that you do need to save (Ctrl/Cmd+S) your server.js file, but the problem here is that you are trying to import a module that is not formatted correctly. To fix this, either try changing the require to require("./node_modules/serverHost/ServerHost.js"), or maybe rename ServerHost.js to index.js, but the correct way would be to cd ./node_modules/serverHost and run npm init, then set the entry to ServerHost.js when prompted. You also don’t have to put ServerHost.js in node_modules, you could just put it in the same folder as server.js and require("./server.js")