Setting Environment Variable

Permanent Setup (Persistent Across Sessions)

NODE_ENV: Specifies the environment for the application (e.g., `production`, `development`).

  1. Step 1: Open PowerShell
    1. Press `Win + R`, type **powershell**, and press **Enter**.
  2. Step 2: Set Environment Variable
    1. Run the following command in PowerShell:

      [System.Environment]::SetEnvironmentVariable("NODE_ENV", "production", "User")

      This will persist the variable across system restarts.

  3. Step 3: Refresh PowerShell to Apply Changes

    $env:NODE_ENV = [System.Environment]::GetEnvironmentVariable("NODE_ENV", "User")

  4. Step 4: Verify the Variables
    1. Check if the variable is set correctly:

      echo $env:NODE_ENV

Temporary Setup (Session-Only)

  • For Windows (PowerShell)

$env:NODE_ENV = "production"

This variable will only be available for the current session.