Skip to content

Instantly share code, notes, and snippets.

@donmccurdy
Last active March 27, 2024 20:30
Show Gist options
  • Save donmccurdy/20fb112949324c92c5e8 to your computer and use it in GitHub Desktop.
Save donmccurdy/20fb112949324c92c5e8 to your computer and use it in GitHub Desktop.
Installing Node.js live-server

Installing Node.js live-server

The NodeJS live-server package runs a temporary server displaying any HTML/CSS/JS resources in the current folder. It automatically reloads the page in your browser when any of these files change.

OS X

  • Verify that Node.js is installed. If you see anything when you run which npm in a terminal, it is. If not, follow the instructions at nodejs.org to install.
  • Install live-server: npm install -g live-server
  • Move your terminal to where your pages live: cd <path-to-content>
  • Start the server: live-server .
  • Open localhost:8080 in a browser.

Windows

Linux

@MaheshReddyHR
Copy link

npm install -g live-server worked fine with me too

I did like npm install -g live-server
But I am getting error like command not found.will u please help me.

@donmccurdy
Copy link
Author

Hi all — please note that I'm not involved with live-server and can't provide help or support for using it. This is just a quick reference that assumes node.js is (1) properly installed and (2) on the $PATH. For help with live-server specifically or global installs with npm generally it may be better to ask on Stack Overflow.

@01alex01
Copy link

01alex01 commented Jan 6, 2023

I did like npm install -g live-server but this is what is showing below

sudo : The term 'sudo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1

  • sudo npm install -g live-server
  •   + CategoryInfo          : ObjectNotFound: (sudo:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

@Abbakarbeety
Copy link

try to run this code "sudo npm install live-server

@OPESCO8891
Copy link

How can I install react with npm, I tried using npm install -g create-react-app but it throws back an error

@billbunkum
Copy link

billbunkum commented Mar 27, 2024 via email

@billbunkum
Copy link

billbunkum commented Mar 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment