6

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?

user3115933
  • 4,303
  • 15
  • 54
  • 94

4 Answers4

13

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.

slebetman
  • 109,858
  • 19
  • 140
  • 171
3
  1. Go to your root folder of your project and run
npm install live-server
  1. To start live server run:
npx live-server
Jan
  • 302
  • 3
  • 5
0

Root folder is where your index.html is saved.(from which your code runs). You can use cd ../ to change your folder and get to root. After which you can easily run live server.

ankitkaushiks
  • 119
  • 1
  • 3
0

Default - npm install live server -g

MacOS - sudo npm install live server -g

Here, npm stands for node package manager and helps us to install various packages.We are requesting npm to install the live server package!

The -g tag implies we are installing it globally (meaning it is available everywhere on our computer).

After installation, run live-server.

asportnoy
  • 2,218
  • 2
  • 17
  • 31