Home

Inline environment variables in CLI

While running npm scripts there are certain situations where you need to set an environment variable for just that particular instance of the command. It is mostly for temporary purposes.

Windows (cmd.exe)

set "BROWSER=none" && npm start

Windows (Powershell)

($env:BROWSER = "none") -and (npm start)

Linux, macOS (Bash)

BROWSER=none npm start

For permanent cases use .env files

Reference

This post is inspired from Create React App's docs



Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments