Local web server and Visual Studio Code

I am using Visual Studio Code to follow the HTML fundamentals lessons of Flatiron Bootcamp.

In order to get a running local web server to see my code in action I chose to use the following procedure which is valid for MAC or PC and I saw in this website: Visual Studio Code and local web server.

  • Create folder for your project and add an index.html file and a package.json file to it. Inside package.json file copy/paste the following text:

I tried that but it didn’t work, I was getting an error  (to see more about it check this link) :
String does not match the pattern of "^(?:@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$".
So I changed the string ‘Demo’ to ‘demo’ and all good.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    • Get the latest version of Node running:

brew update

    • Install node running:

brew install node

    • Test that you got Node running:

node -v

    • Test that you got NPM running:

npm -v

  • Install the web server running:

npm install

This will install lite-server (defined in package.json), a static server that loads index.html in your default browser and auto refreshes it when application files change.

  • Start the local web server running:

npm start

Done!!

Leave a Reply

Your email address will not be published.