Require my file


#1

Sorry for the translation of messages through a translator.
Hey.
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.


#2

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?

Dana


#3

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")