angular/angular-cli · error · Error
Unable to load message extractor. Please ensure '@angular/lo
Error message
Unable to load message extractor. Please ensure '@angular/localize' is installed.
What it means
ivy-extract-loader dynamically imports `@angular/localize/tools` to obtain the MessageExtractor class used for ivy i18n extraction. If that dynamic import fails (module not installed, version mismatch, or not resolvable), it throws this error telling the user to install @angular/localize. The extract-i18n builder relies on this package as a peer runtime dependency even though the CLI itself does not bundle its tools.
Source
Thrown at packages/angular_devkit/build_angular/src/builders/extract-i18n/ivy-extract-loader.ts:53
},
(error) => {
callback(error);
},
);
}
async function extract(
loaderContext: import('webpack').LoaderContext<LocalizeExtractLoaderOptions>,
content: string,
map: string | LoaderSourceMap | undefined,
options: LocalizeExtractLoaderOptions,
) {
let MessageExtractor;
try {
const { MessageExtractor: MsgExtractor } = await import('@angular/localize/tools');
MessageExtractor = MsgExtractor;
} catch {
throw new Error(
`Unable to load message extractor. Please ensure '@angular/localize' is installed.`,
);
}
// Setup a Webpack-based logger instance
const logger = {
// level 2 is warnings
level: 2,
debug(...args: string[]): void {
// eslint-disable-next-line no-console
console.debug(...args);
},
info(...args: string[]): void {
loaderContext.emitWarning(new Error(args.join('')));
},
warn(...args: string[]): void {
loaderContext.emitWarning(new Error(args.join('')));
},View on GitHub (pinned to bb72145f9a)
Solutions
- Install the package: `ng add @angular/localize` or `npm install @angular/localize --save-dev` (or yarn/pnpm equivalent).
- Ensure the installed @angular/localize version matches your Angular CLI/framework version.
- Delete node_modules and the lockfile entry and reinstall to repair a partial install.
- If using pnpm/npm workspaces, confirm the package is resolvable from the project directory (check node_modules/@angular/localize/tools exists).
Example fix
// before (package.json devDependencies)
// "@angular/localize" missing
// after
"devDependencies": {
"@angular/localize": "^18.0.0"
} Defensive patterns
Strategy: validation
Validate before calling
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
try {
require.resolve('@angular/localize/tools');
} catch {
throw new Error("Install @angular/localize: ng add @angular/localize");
} Try / catch
try {
await ngExtractI18n();
} catch (e) {
if (e.message.includes("Unable to load message extractor")) {
console.error("Run: ng add @angular/localize");
} else throw e;
} Prevention
- Always run `ng add @angular/localize` when enabling i18n extraction.
- Keep @angular/localize version in lockstep with the Angular CLI version.
- In monorepos, declare the dependency in the relevant workspace package.
- Verify node_modules/@angular/localize/tools exists in CI before running extraction.
When it happens
Trigger: Running `ng extract-i18n` when `@angular/localize` is not in the project's node_modules; a broken/partial install where the `tools` entry point is missing; a version mismatch where the installed localize version does not export MessageExtractor from its tools entry point.
Common situations: Fresh projects where localize was never added (`ng add @angular/localize` skipped); monorepos where the dependency is hoisted incorrectly or absent from the workspace; upgrading Angular CLI without upgrading @angular/localize to a compatible version.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Unknown file requested: ${requestedPath}
- Unknown file requested: ${path}
- Project '${projectName}' not found in workspace path ${works
- No project name provided and no default project found in wor
- Unknown argument: configuration. Provide the configuration a
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/0088c43c315fc02d.
Report an issue: GitHub.