Setting Environment Variable
Permanent Setup (Persistent Across Sessions)
NODE_ENV: Specifies the environment for the application (e.g., `production`, `development`).
- Step 1: Open PowerShell
- Press `Win + R`, type **powershell**, and press **Enter**.
- Step 2: Set Environment Variable
- Run the following command in PowerShell:
[System.Environment]::SetEnvironmentVariable("NODE_ENV", "production", "User")This will persist the variable across system restarts.
- Run the following command in PowerShell:
- Step 3: Refresh PowerShell to Apply Changes
$env:NODE_ENV = [System.Environment]::GetEnvironmentVariable("NODE_ENV", "User") - Step 4: Verify the Variables
- Check if the variable is set correctly:
echo $env:NODE_ENV
- Check if the variable is set correctly:
Temporary Setup (Session-Only)
- For Windows (PowerShell)
$env:NODE_ENV = "production"
This variable will only be available for the current session.