lerna/lerna · error · Error
Failed to replace env in config: ${orig}
Error message
Failed to replace env in config: ${orig} What it means
Error "Failed to replace env in config: ${orig}" thrown in lerna/lerna.
Source
Thrown at libs/core/src/lib/npm-conf/env-replace.ts:21
if (typeof str !== "string" || !str) {
return str;
}
// Replace any ${ENV} values with the appropriate environment
const regex = /(\\*)\$\{([^}]+)\}/g;
// TODO: refactor based on TS feedback
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return str.replace(regex, (orig, esc, name) => {
esc = esc.length > 0 && esc.length % 2;
if (esc) {
return orig;
}
if (process.env[name] === undefined) {
throw new Error(`Failed to replace env in config: ${orig}`);
}
return process.env[name];
});
}
View on GitHub (pinned to 35d15a1567)
When it happens
Trigger: Thrown at libs/core/src/lib/npm-conf/env-replace.ts:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of lerna/lerna@35d15a1567 (2026-08-27).
Data as JSON: /api/errors/954f7c59e19db0a2.
Report an issue: GitHub.