Home > Net >  How to run web project in Vs Code using terminal?
How to run web project in Vs Code using terminal?

Time:12-15

I watch a video on youtube and the creator created a simple HTML js project after that he just run it in the terminal of vs Code. I search about this on youtube and google but I can't understand it. If someone how have any idea to do that I'll be grateful. thank you.

CodePudding user response:

You should get help from Node.js ecosystem!

  1. Install Node.js LTS version from official website! (node.js website)

  2. Install live-server package(live-server website) globally

  3. Go to the directory where the project is.

    ~ cd path/to/project

  4. Then just run

    ~ live-server

CodePudding user response:

You can use a VSCODE extension for localhosting your static files. Its called Liveserver.

CodePudding user response:

You can use nodejs, but you can't use some javascript keywords and methods which run on the browser like document addEventListener (but we have on method). Because node is built for server-side applications, there is no document on the server.

If you are working on a frontend application, there are many packages you can use, like

  • serve (npm install -g serve)
  • live server (npm install -g live-server)
  • webpack
  • Related