Node.js does not run correctly

Asked

Viewed 43 times

0

Good morning, afternoon, evening, I’ve been having these problems for a few days, and now it’s crucial I fix it, but my experience is 0 with Nod.js, React, someone can help me out?

What I already did; I deleted the node_module and pack-block.json folders, several times and reinstalled everything, but nothing solves, I ran some different codes for linux (linux use) even so there was no effect. Please someone can help me get out of this?

aqui fiz algumas configurações para rodar, npm start dev, que não funcionou.

 Aqui esta o erro completo.

1 answer

2


This error occurs when you try run the file and Node cannot find it, make sure you are passing the correct location of the server.js file,

In the photo, your file is inside the folder src, then considering that in your terminal you are in the root folder, you should run your program using:

node src/server.js

I believe that for an oversight you are trying to execute in the wrong way: node server.js

  • Look, I’m sorry I’m unaware on this journey of mine, but could I be specific, like I add, this code that tells me, what exactly would I do? Again sorry, I really didn’t understand.

  • 1

    Inside the vscode, with the project open, open a terminal by clicking on the top tab "terminal" and selecting the option "new terminal". Already open, just copy and paste the first code I mentioned, (Node src/server.js), after that press ENTER and it should already run its file server.js

  • 1

    Thank you, now I need to check how to open both servers to finish. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.