Environment Setup
This tutorial will guide you through installing the necessary tools for a web programming environment. You’ll learn how to install the following:
- Code Editor: VS Code
- Version Control: Git
- Node.js: For JavaScript runtime
- Browser: Chrome with Developer Tools
1. Install Visual Studio Code (VS Code)
VS Code is a lightweight code editor with excellent support for web development.
Steps:
- Go to the VS Code website.
- Download the installer for your operating system (Windows, macOS, or Linux).
- Follow the installation instructions:
- On Windows: Open the downloaded
.exefile and follow the installer. - On macOS: Open the
.dmgfile and drag VS Code to theApplicationsfolder. - On Linux: Follow the package manager instructions on the website.
- On Windows: Open the downloaded
- Launch VS Code after installation.
Extensions to Install:
- Live Server: Enables real-time preview of your website.
- Open VS Code, click on the Extensions icon (
⇧⌘XorCtrl+Shift+X), search for "Live Server" and install it.
- Open VS Code, click on the Extensions icon (
2. Install Git (Version Control)
Git is essential for managing your code and collaborating with others.
Steps:
- Visit the official Git website.
- Download the installer for your operating system.
- Install Git:
- On Windows: Follow the installer and use default options unless you need something specific.
- On macOS: Open Terminal and run
brew install git(if you have Homebrew installed) or download Git from the website. - On Linux: Use your package manager, e.g.,
sudo apt-get install git(Debian/Ubuntu) orsudo dnf install git(Fedora).
- Verify installation by opening a terminal (or Command Prompt on Windows) and typing:
You should see the Git version number if it's installed correctly.
git --version
3. Install Node.js (JavaScript Runtime)
Node.js allows you to run JavaScript outside of the browser and install essential development tools.
Steps:
- Go to the Node.js website.
- Download the LTS version (recommended for most users).
- Install Node.js:
- On Windows and macOS: Follow the installer instructions.
- On Linux: Use the package manager, e.g.,
sudo apt install nodejs npm
- Verify installation:
- Open a terminal or Command Prompt and run:
node --version - Then check npm (Node's package manager) with:
npm --version
- Open a terminal or Command Prompt and run:
NPM Packages for Web Development:
- Install Webpack (used to bundle and serve your code):
npm install --global webpack webpack-cli
4. Install Google Chrome (for Testing & DevTools)
Chrome is a widely-used browser with powerful developer tools.
Steps:
- Go to the Google Chrome website.
- Download the installer for your operating system.
- Follow the installation instructions.
- Launch Chrome.
Open Developer Tools in Chrome:
- Right-click on any web page and select Inspect, or press
F12(Windows) or⌘ + Option + I(Mac).
5. Optional: Install BrowserSync (for live reloading)
BrowserSync is a tool that automatically refreshes your browser when you make changes to your code.
Steps:
- Open a terminal and run:
npm install -g browser-sync - Navigate to your project folder and run:
browser-sync start --server --files "*.html, *.css, *.js" - This command starts a local server and refreshes your browser when files change.
6. Verify Your Setup
Now that you’ve installed the essential tools, let's verify that everything works.
Steps:
- Create a new folder for your project:
mkdir my-web-project
cd my-web-project - Create a simple
index.htmlfile:<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html> - Open the folder in VS Code and launch Live Server (from the VS Code status bar).
- Verify that your browser opens and displays "Hello, World!".
7. Set Up GitHub (Optional)
GitHub is a popular platform for hosting and sharing code.
Steps:
- Create a GitHub account.
- Configure Git to use GitHub:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com" - Create a new repository on GitHub and follow the instructions to push your local code.
Conclusion
With these tools, you are ready to start developing web applications locally. Happy coding!