Angular MFE Prerequisites & Environment Setup | Complete Guide
Before diving into Angular Micro Frontend development, let’s ensure your development environment is properly configured with all the necessary tools and dependencies.
🛠️ Required Software & Tools
Section titled “🛠️ Required Software & Tools”1. Node.js (v18 or Later)
Section titled “1. Node.js (v18 or Later)”Node.js is the foundation for Angular development and npm package management.
Installation Options:
Section titled “Installation Options:”Option A: Direct Download
# Visit https://nodejs.org and download LTS version# Install the downloaded package
Option B: Using NVM (Recommended)
Unix/macOS:
# Install NVM (Node Version Manager)curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Restart terminal or source profilesource ~/.bashrc
# Install and use Node.js 18nvm install 18nvm use 18nvm alias default 18
Windows:
# Step 1: Download and install nvm for Windows from:Start-Process "https://github.com/coreybutler/nvm-windows/releases/latest/download/nvm-setup.exe"
# Step 2: Install Node.js version 18nvm install 18
# Step 3: Use Node.js version 18 for current sessionnvm use 18
# Step 4: Set Node.js version 18 as defaultnvm alias default 18
Option C: Using Package Managers
Windows:
# Using Chocolateychoco install nodejs
# Using Wingetwinget install OpenJS.NodeJS
# Using Scoopscoop install nodejs
macOS:
# Using Homebrewbrew install node
Ubuntu/Debian:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -sudo apt-get install -y nodejs
Verify Installation:
Section titled “Verify Installation:”node --version # Should show v18.x.x or laternpm --version # Should show 8.x.x or later
2. Angular CLI (Latest Version)
Section titled “2. Angular CLI (Latest Version)”The Angular CLI is essential for creating, building, and managing Angular applications.
Installation:
Section titled “Installation:”# Install Angular CLI globallynpm install -g @angular/cli@latest
# Verify installationng version
Expected Output:
Section titled “Expected Output:”Angular CLI: 17.x.xNode: 18.x.xPackage Manager: npm 8.x.xOS: [your-operating-system]
Update Existing Angular CLI:
Section titled “Update Existing Angular CLI:”# Uninstall old versionnpm uninstall -g @angular/cli
# Clear cachenpm cache clean --force
# Install latest versionnpm install -g @angular/cli@latest
3. Git & GitHub Setup
Section titled “3. Git & GitHub Setup”Version control is crucial for managing multiple MFE repositories.
Install Git:
Section titled “Install Git:”Windows:
# Option 1: Download from official websiteStart-Process "https://git-scm.com/download/win"
# Option 2: Using Chocolateychoco install git
# Option 3: Using Wingetwinget install Git.Git
macOS:
# Using Homebrewbrew install git
# Using Xcode Command Line Toolsxcode-select --install
Ubuntu/Debian:
sudo apt-get install git
Configure Git:
Section titled “Configure Git:”git config --global user.name "Your Name"git config --global user.email "bnarayan.sharma@outlook.com"
# Verify configurationgit config --list
GitHub Setup:
Section titled “GitHub Setup:”- Create GitHub account at https://github.com
- Generate SSH key for secure access:
Unix/macOS:
# Generate SSH keyssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com"
# Start SSH agenteval "$(ssh-agent -s)"
# Add SSH key to agentssh-add ~/.ssh/id_ed25519
# Copy public key to clipboardcat ~/.ssh/id_ed25519.pub
Windows:
# Generate SSH keyssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com"
# Start SSH agent (in PowerShell as Administrator)Start-Service ssh-agentSet-Service -Name ssh-agent -StartupType Manual
# Add SSH key to agentssh-add $env:USERPROFILE\.ssh\id_ed25519
# Copy public key to clipboardGet-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard
-
Add SSH key to GitHub:
- Go to GitHub → Settings → SSH and GPG keys
- Click “New SSH key”
- Paste your public key
-
Test SSH connection:
ssh -T git@github.com
4. Code Editor: Visual Studio Code
Section titled “4. Code Editor: Visual Studio Code”VS Code provides excellent Angular development support with extensions.
Installation:
Section titled “Installation:”- Download from https://code.visualstudio.com/
- Install the appropriate version for your OS
Essential VS Code Extensions:
Section titled “Essential VS Code Extensions:”# Install extensions using VS Code command palette (Ctrl+Shift+P)# or install via command line:
code --install-extension Angular.ng-templatecode --install-extension ms-vscode.vscode-typescript-nextcode --install-extension bradlc.vscode-tailwindcsscode --install-extension ms-vscode.vscode-jsoncode --install-extension esbenp.prettier-vscodecode --install-extension ms-vscode.vscode-eslint
Recommended Extensions List:
Section titled “Recommended Extensions List:”- Angular Language Service: IntelliSense for Angular templates
- TypeScript Importer: Auto import TypeScript modules
- Prettier: Code formatting
- ESLint: Code linting
- GitLens: Enhanced Git capabilities
- Bracket Pair Colorizer: Better code readability
- Auto Rename Tag: Rename paired HTML tags
- Angular Snippets: Code snippets for Angular
5. Package Managers & Build Tools
Section titled “5. Package Managers & Build Tools”NPM (Included with Node.js):
Section titled “NPM (Included with Node.js):”# Verify npm installationnpm --version
# Update npm to latest versionnpm install -g npm@latest
Yarn (Alternative Package Manager):
Section titled “Yarn (Alternative Package Manager):”# Install Yarn globallynpm install -g yarn
# Verify installationyarn --version
Webpack (For Module Federation):
Section titled “Webpack (For Module Federation):”# Webpack will be installed per project# But you can install CLI globally for debuggingnpm install -g webpack-cli
☁️ Cloud Platform Setup
Section titled “☁️ Cloud Platform Setup”Azure Account & Azure CLI
Section titled “Azure Account & Azure CLI”For deploying to Azure Static Web Apps:
Create Azure Account:
Section titled “Create Azure Account:”- Visit https://azure.microsoft.com/free/
- Sign up for free account (includes $200 credit)
- Verify email and complete setup
Install Azure CLI:
Section titled “Install Azure CLI:”Windows:
# Option 1: Download MSI installerStart-Process "https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows"
# Option 2: Using Chocolateychoco install azure-cli
# Option 3: Using Wingetwinget install Microsoft.AzureCLI
macOS:
# Using Homebrewbrew install azure-cli
Ubuntu/Debian:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Login to Azure:
Section titled “Login to Azure:”# Login to Azure accountaz login
# Verify loginaz account show
Azure Static Web Apps CLI:
Section titled “Azure Static Web Apps CLI:”# Install Static Web Apps CLInpm install -g @azure/static-web-apps-cli
# Verify installationswa --version
🔧 Development Environment Configuration
Section titled “🔧 Development Environment Configuration”Terminal/Command Line Setup
Section titled “Terminal/Command Line Setup”Windows Users:
Section titled “Windows Users:”- Windows Terminal (Recommended): Install from Microsoft Store
- PowerShell 7+: Download from GitHub releases
- Git Bash: Included with Git installation
macOS/Linux Users:
Section titled “macOS/Linux Users:”- Use default terminal or install iTerm2 (macOS) or Terminator (Linux)
Environment Variables
Section titled “Environment Variables”Create a global environment file for common environment variables:
Unix/macOS:
# Create global environment filetouch ~/.env
# Add common variablesecho "NODE_ENV=development" >> ~/.envecho "ANGULAR_CLI_ANALYTICS=false" >> ~/.env
Windows:
# Create global environment fileNew-Item -Path $env:USERPROFILE\.env -ItemType File -Force
# Add common variablesAdd-Content -Path $env:USERPROFILE\.env -Value "NODE_ENV=development"Add-Content -Path $env:USERPROFILE\.env -Value "ANGULAR_CLI_ANALYTICS=false"
# Alternative: Set system environment variables[Environment]::SetEnvironmentVariable("NODE_ENV", "development", "User")[Environment]::SetEnvironmentVariable("ANGULAR_CLI_ANALYTICS", "false", "User")
NPM Configuration
Section titled “NPM Configuration”Configure npm for better performance and security:
Unix/macOS/Windows:
# Set npm registry (optional)npm config set registry https://registry.npmjs.org/
# Disable analyticsnpm config set analytics false
# Set cache location (optional)npm config set cache ~/.npm-cache
Windows (PowerShell alternative):
# Set npm registry (optional)npm config set registry https://registry.npmjs.org/
# Disable analyticsnpm config set analytics false
# Set cache location (Windows-specific path)npm config set cache "$env:USERPROFILE\.npm-cache"
📦 Project-Specific Tools
Section titled “📦 Project-Specific Tools”Module Federation Dependencies
Section titled “Module Federation Dependencies”These will be installed per project, but good to know:
# Core Module Federation packages@angular-architects/module-federationwebpackwebpack-cli@angular-builders/custom-webpack
Development Dependencies
Section titled “Development Dependencies”Common dev dependencies for MFE projects:
# TypeScripttypescript@types/node
# Testing@angular/testingjasminekarma
# Lintingeslint@typescript-eslint/parser@typescript-eslint/eslint-plugin
# Build tools@angular-devkit/build-angular
✅ Environment Verification Checklist
Section titled “✅ Environment Verification Checklist”Run these commands to verify your setup:
System Check Script
Section titled “System Check Script”Create a verification script:
Unix/macOS (check-environment.sh):
#!/bin/bashecho "=== Angular MFE Environment Check ==="echo ""
echo "Node.js version:"node --version
echo "NPM version:"npm --version
echo "Angular CLI version:"ng version --skip-git
echo "Git version:"git --version
echo "Azure CLI version:"az --version | head -1
echo "VS Code version:"code --version | head -1
echo ""echo "=== Environment Check Complete ==="
Windows (check-environment.ps1):
Write-Host "=== Angular MFE Environment Check ===" -ForegroundColor BlueWrite-Host ""
Write-Host "Node.js version:" -ForegroundColor Greennode --version
Write-Host "NPM version:" -ForegroundColor Greennpm --version
Write-Host "Angular CLI version:" -ForegroundColor Greenng version --skip-git
Write-Host "Git version:" -ForegroundColor Greengit --version
Write-Host "Azure CLI version:" -ForegroundColor Greenaz --version | Select-Object -First 1
Write-Host "VS Code version:" -ForegroundColor Greencode --version | Select-Object -First 1
Write-Host ""Write-Host "=== Environment Check Complete ===" -ForegroundColor Blue
Running the script:
Unix/macOS:
chmod +x check-environment.sh./check-environment.sh
Windows:
# Enable script execution (run as Administrator if needed)Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Run the script.\check-environment.ps1
Expected Versions Summary
Section titled “Expected Versions Summary”Tool | Minimum Version | Recommended |
---|---|---|
Node.js | 18.0.0 | 18.17.0+ |
NPM | 8.0.0 | 9.0.0+ |
Angular CLI | 15.0.0 | 17.0.0+ |
Git | 2.20.0 | 2.40.0+ |
VS Code | 1.70.0 | Latest |
🔍 Common Setup Issues & Solutions
Section titled “🔍 Common Setup Issues & Solutions”Issue 1: Permission Errors with NPM
Section titled “Issue 1: Permission Errors with NPM”Unix/macOS:
# Solution: Configure npm to use different directorymkdir ~/.npm-globalnpm config set prefix '~/.npm-global'
# Add to ~/.bashrc or ~/.zshrcexport PATH=~/.npm-global/bin:$PATH
# Reload shellsource ~/.bashrc
Windows:
# Solution: Configure npm to use different directoryNew-Item -Path "$env:USERPROFILE\.npm-global" -ItemType Directory -Forcenpm config set prefix "$env:USERPROFILE\.npm-global"
# Add to PATH environment variable$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")$newPath = "$env:USERPROFILE\.npm-global;$currentPath"[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
# Restart PowerShell for changes to take effect
Issue 2: Angular CLI Installation Fails
Section titled “Issue 2: Angular CLI Installation Fails”# Clear npm cachenpm cache clean --force
# Remove existing Angular CLInpm uninstall -g @angular/cli
# Reinstall with specific versionnpm install -g @angular/cli@latest
Issue 3: Git SSH Issues
Section titled “Issue 3: Git SSH Issues”# Test SSH connectionssh -T git@github.com
# If issues, regenerate SSH keyssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com" -f ~/.ssh/id_ed25519_new
# Add new key to SSH agentssh-add ~/.ssh/id_ed25519_new
Issue 4: VS Code Extensions Not Working
Section titled “Issue 4: VS Code Extensions Not Working”# Reset VS Code extensionscode --list-extensionscode --uninstall-extension <extension-id>code --install-extension <extension-id>
🚀 Performance Optimization
Section titled “🚀 Performance Optimization”Development Machine Optimization
Section titled “Development Machine Optimization”Unix/macOS:
# Increase Node.js memory limitexport NODE_OPTIONS="--max-old-space-size=8192"
# Enable Angular CLI completionng completion bash >> ~/.bashrc # or ~/.zshrcsource ~/.bashrc
Windows:
# Increase Node.js memory limit[Environment]::SetEnvironmentVariable("NODE_OPTIONS", "--max-old-space-size=8192", "User")
# Enable Angular CLI completion (PowerShell)ng completion powershell | Out-String | Invoke-Expression
# Add to PowerShell profile for persistenceng completion powershell >> $PROFILE
NPM Performance
Section titled “NPM Performance”# Use npm ci for faster installs in CI/CDnpm ci
# Enable parallel installsnpm config set fund falsenpm config set audit false
📚 Additional Setup Resources
Section titled “📚 Additional Setup Resources”Documentation Links
Section titled “Documentation Links”- Node.js Installation Guide
- Angular CLI Documentation
- Git Installation Guide
- VS Code Setup Guide
- Azure CLI Installation
Video Tutorials
Section titled “Video Tutorials”✅ What’s Next?
Section titled “✅ What’s Next?”Once your environment is set up and verified:
- ✅ Environment Setup Complete
- ➡️ Continue to: Project Setup - Creating repositories and initial project structure
- 📚 Learn More: Review Angular MFE Introduction if you haven’t already
Your development environment is now ready for Angular Micro Frontend development! 🚀