How to run live server after Node.js and npm installation

user3115933 picture user3115933 · Apr 16, 2020 · Viewed 23.5k times · Source

I am using Windows 10 and I have installed Node.js (with npm) on my local machine. I am trying to follow an instruction which says:

"Once node.js and npm are installed, run the following command in your terminal.

npm install -g live-server

This will install live-server⁵, a simple static server that has live reload built-in. To
start your server, run live-server in your terminal from the root /code folder —
it will even open a new browser window for you!"

Since I am on Windows, I guess "Terminal" means "Command Prompt". So, I have run the "npm install -g live-server" from C:// prompt.

I am now confused about the part where it says "run live-server in your terminal from the root /code folder".

What is the root /code folder?

Answer

slebetman picture slebetman · Apr 16, 2020

In the command prompt, either cmd.com or Windows terminal (yes, the new one actually has the word "terminal" in its name), cd to your project directory (referred to by the docs as the "root" or "code" folder) then type:

live-server

It is literally installed as a command just like cd, dir etc.

The "root" folder or "code" folder is literally the folder where you saved your index.html file.