How to Use npm live-server
How to use npm's live-server
NPM live-server is very cool when you want to setup server to
serve files under development, such as server as web server for your
HTML/Javascript/CSS files. To use it you'll need to have
npm
installed first.At my development machine, I'm using windows
7 and node.js version is v6.5.0
, npm version is
3.10.3
.So after install
node.js, type following command to install npm package
live-server to your local environment.
npm install -g live-server
Above command will install npm module live-server
global at your
machine, once you install you can use it at any directory folder at your pc by
typing following command.
live-server
Now, after you typed the command, if browser show your folder then you're
good. However, if command line display as
live-server is not recognized as an internal or external command
, then it probably live-server or node.js' execution path is not setup at
windows' environment variable.
So, verify your System Properties - Environment Variables - Path Variable. Check to see if either node.js or live-server path is there or not, if it's there, then restart command line and run it again. Sometime, command line need restart. Now, if it's not there, you can reference the version works on my computer.
Following is the path at my windows environment path.
C:\Program Files\nodejs\
Following is how I run live-server at my picture folder.