microsoft/monaco-editor · error · Error
Missing PRERELEASE_VERSION in process.env
Error message
Missing PRERELEASE_VERSION in process.env
What it means
Thrown by getNightlyEnv() when process.env.PRERELEASE_VERSION is falsy. getNightlyEnv is only called by the nightly release path, which uses PRERELEASE_VERSION to compute the prerelease tag (e.g. 0.x.x-dev.YYYYMMMM) appended to the base version. The guard ensures a nightly never ships without a prerelease suffix, which would collide with the stable version on npm. The check runs before any git clone or build step.
Source
Thrown at scripts/ci/env.ts:9
interface Env {
VSCODE_REF: string;
PRERELEASE_VERSION: string;
}
export function getNightlyEnv(): Env {
const env: Env = process.env as any;
if (!env.PRERELEASE_VERSION) {
throw new Error(`Missing PRERELEASE_VERSION in process.env`);
}
if (!env.VSCODE_REF) {
throw new Error(`Missing VSCODE_REF in process.env`);
}
return env;
}
View on GitHub (pinned to ca1b42dc89)
Solutions
- Export the variable before running the script: `PRERELEASE_VERSION=<value> node scripts/ci/build-monaco-editor-core-pkg.ts nightly`.
- In CI, add PRERELEASE_VERSION to the job's `env:` block or to the repository/organization secrets consumed by that job.
- Verify the variable is non-empty (not just defined) — an empty string also triggers the throw.
- If testing locally without a real prerelease, set a throwaway value like `0.0.0-dev-test` to satisfy the guard.
Example fix
// before $ node scripts/ci/build-monaco-editor-pkg.ts nightly // throws: Missing PRERELEASE_VERSION in process.env // after $ PRERELEASE_VERSION=0.34.0-dev.20240101 node scripts/ci/build-monaco-editor-pkg.ts nightly
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.PRERELEASE_VERSION) {
console.error('PRERELEASE_VERSION is required for nightly builds.');
process.exit(2);
}
// then run the nightly build Type guard
function hasPrereleaseVersion(env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { PRERELEASE_VERSION: string } {
return Boolean(env.PRERELEASE_VERSION);
} Prevention
- Document required nightly env vars in the release runbook.
- In CI, add a job-level `env:` assertion step that fails fast on missing vars.
- Scope the secret to the correct GitHub environment so the nightly job can see it.
When it happens
Trigger: Running the nightly build (`build-monaco-editor-core-pkg.ts nightly` or `build-monaco-editor-pkg.ts nightly`) in a shell or CI runner where PRERELEASE_VERSION is unset or empty. Also when a CI secret/variable was renamed or scoped to the wrong environment.
Common situations: CI workflow missing the env var in the nightly job; developer running nightly build locally without exporting the var; pipeline migrated to a new runner template that dropped the env injection; PRERELEASE_VERSION set on a different GitHub environment than the one the job uses.
Related errors
- Missing VSCODE_REF in process.env
- Invalid argument
- Invalid argument
- Cannot merge ${fieldName}: property '${key}' already exists
AI-assisted analysis of microsoft/monaco-editor@ca1b42dc89 (2026-08-13).
Data as JSON: /api/errors/b28e6dba1ab00ba9.
Report an issue: GitHub.