Hi, I’m upgrading my Angular project: ABP v9.0 -> v9.2.4 Angular v18.0 -> v19.2.17
Now I got these errors in browser console:
An error occurred: NullInjectorError: NullInjectorError: No provider for InjectionToken CORE_OPTIONS! at NullInjector.get (core.mjs:1600:21) at R3Injector.get (core.mjs:2130:27) at R3Injector.get (core.mjs:2130:27) at injectInjectorOnly (core.mjs:1111:28) at ɵɵinject (core.mjs:1117:40) at Object.RestService_Factory [as factory] (abp-ng.core.mjs:1018:56) at core.mjs:2243:35 at runInInjectorProfilerContext (core.mjs:881:5) at R3Injector.hydrate (core.mjs:2242:11) at R3Injector.get (core.mjs:2121:23) handleError @ main.js:21318 (anonymous) @ core.mjs:34987 invoke @ polyfills.js:341 run @ polyfills.js:99 runOutsideAngular @ core.mjs:6297 _callAndReportToErrorHandler @ core.mjs:34987 (anonymous) @ core.mjs:34931 invoke @ polyfills.js:341 onInvoke @ core.mjs:6401 invoke @ polyfills.js:341 run @ polyfills.js:99 run @ core.mjs:6253 bootstrap @ core.mjs:34887 bootstrapModuleFactory @ core.mjs:35035 (anonymous) @ core.mjs:35059 invoke @ polyfills.js:341 run @ polyfills.js:99 (anonymous) @ polyfills.js:2037 invokeTask @ polyfills.js:366 runTask @ polyfills.js:149 drainMicroTaskQueue @ polyfills.js:526 Promise.then nativeScheduleMicroTask @ polyfills.js:506 scheduleMicroTask @ polyfills.js:513 scheduleTask @ polyfills.js:358 scheduleTask @ polyfills.js:188 scheduleMicroTask @ polyfills.js:203 scheduleResolveOrReject @ polyfills.js:2029 then @ polyfills.js:2219 bootstrapModule @ core.mjs:35059 (anonymous) @ main.js:21548 main.js:21548 NullInjectorError: NullInjectorError: No provider for InjectionToken CORE_OPTIONS! at NullInjector.get (core.mjs:1600:21) at R3Injector.get (core.mjs:2130:27) at R3Injector.get (core.mjs:2130:27) at injectInjectorOnly (core.mjs:1111:28) at ɵɵinject (core.mjs:1117:40) at Object.RestService_Factory [as factory] (abp-ng.core.mjs:1018:56) at core.mjs:2243:35 at runInInjectorProfilerContext (core.mjs:881:5) at R3Injector.hydrate (core.mjs:2242:11) at R3Injector.get (core.mjs:2121:23) (anonymous) @ main.js:21548 invoke @ polyfills.js:341 run @ polyfills.js:99 (anonymous) @ polyfills.js:2037 invokeTask @ polyfills.js:366 runTask @ polyfills.js:149 drainMicroTaskQueue @ polyfills.js:526 Promise.then nativeScheduleMicroTask @ polyfills.js:506 scheduleMicroTask @ polyfills.js:513 scheduleTask @ polyfills.js:358 scheduleTask @ polyfills.js:188 scheduleMicroTask @ polyfills.js:203 scheduleResolveOrReject @ polyfills.js:2029 then @ polyfills.js:2219 bootstrapModule @ core.mjs:35059 (anonymous) @ main.js:21548
chunk-CZFTEK6J.js:78 Cannot find the en locale file. You can check how can add new culture at https://abp.io/docs/latest/framework/ui/angular/localization#adding-a-new-culture
app.module.ts
import { CoreModule } from '@abp/ng.core'; import { SettingManagementConfigModule } from '@abp/ng.setting-management/config'; import { HTTP_ERROR_HANDLER, provideAbpThemeShared, ThemeSharedModule, withValidationBluePrint } from '@abp/ng.theme.shared'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { IdentityConfigModule } from '@volo/abp.ng.identity/config'; import { CommercialUiConfigModule } from '@volo/abp.commercial.ng.ui/config'; import { AccountAdminConfigModule } from '@volo/abp.ng.account/admin/config'; import { AccountPublicConfigModule } from '@volo/abp.ng.account/public/config'; import { GdprConfigModule } from '@volo/abp.ng.gdpr/config'; import { AuditLoggingConfigModule } from '@volo/abp.ng.audit-logging/config'; import { LanguageManagementConfigModule } from '@volo/abp.ng.language-management/config'; import { registerLocale } from '@volo/abp.ng.language-management/locale'; import { FileManagementConfigModule } from '@volo/abp.ng.file-management/config'; import { SaasConfigModule } from '@volo/abp.ng.saas/config'; import { TextTemplateManagementConfigModule } from '@volo/abp.ng.text-template-management/config'; import { OpeniddictproConfigModule } from '@volo/abp.ng.openiddictpro/config'; import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { APP_ROUTE_PROVIDER } from './route.provider'; import { FeatureManagementModule } from '@abp/ng.feature-management'; import { HttpErrorComponent, ThemeLeptonXModule } from '@volosoft/abp.ng.theme.lepton-x'; import { SideMenuLayoutModule } from '@volosoft/abp.ng.theme.lepton-x/layouts'; import { AccountLayoutModule } from '@volosoft/abp.ng.theme.lepton-x/account'; import { AbpOAuthModule } from '@abp/ng.oauth'; import { CustomHeaderInterceptor } from './api/custom-header.interceptor'; import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { MarkdownModule } from 'ngx-markdown'; import { handleHttpErrors } from './utils/http-error-handler'; import { FileDescriptorService } from '@volo/abp.ng.file-management/proxy'; import { FileDescriptorExtendedService } from './file/services/file-descriptor-extended.service'; import { providePostHogErrorHandler } from './posthog-error-handler'; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, BrowserAnimationsModule, AppRoutingModule, CoreModule.forRoot({ environment, registerLocaleFn: registerLocale(), }), AbpOAuthModule.forRoot(), ThemeSharedModule.forRoot({ httpErrorConfig: { errorScreen: { component: HttpErrorComponent, forWhichErrors: [401, 403, 404, 500], hideCloseIcon: true, }, }, }), // AccountAdminConfigModule.forRoot(), AccountPublicConfigModule.forRoot(), CommercialUiConfigModule.forRoot(), GdprConfigModule.forRoot({ privacyPolicyUrl: 'https://www.lexarius.com/privacy-policy', cookiePolicyUrl: 'gdpr-cookie-consent/cookie', }), LanguageManagementConfigModule.forRoot(), FileManagementConfigModule.forRoot(), SaasConfigModule.forRoot(), AuditLoggingConfigModule.forRoot(), OpeniddictproConfigModule.forRoot(), TextTemplateManagementConfigModule.forRoot(), IdentityConfigModule.forRoot(), SettingManagementConfigModule.forRoot(), ThemeLeptonXModule.forRoot(), SideMenuLayoutModule.forRoot(), AccountLayoutModule.forRoot(), FeatureManagementModule.forRoot(), MarkdownModule.forRoot(), ], providers: [ APP_ROUTE_PROVIDER, { provide: HTTP_INTERCEPTORS, useClass: CustomHeaderInterceptor, multi: true, }, { provide: HTTP_ERROR_HANDLER, useValue: handleHttpErrors }, provideAbpThemeShared( withValidationBluePrint({ integer: "::Validation:IntegerOnly", dateRange: "::Validation:DateRangeValidation", }) ), { provide: FileDescriptorService, useClass: FileDescriptorExtendedService }, providePostHogErrorHandler(), ], bootstrap: [AppComponent], }) export class AppModule { }
package.json
{ dependencies": { "@abp/ng.components": "~9.2.4", "@abp/ng.core": "~9.2.4", "@abp/ng.oauth": "~9.2.4", "@abp/ng.setting-management": "~9.2.4", "@abp/ng.theme.shared": "~9.2.4", "@angular/animations": "~19.2.17", "@angular/common": "~19.2.17", "@angular/compiler": "~19.2.17", "@angular/core": "~19.2.17", "@angular/forms": "~19.2.17", "@angular/localize": "~19.2.17", "@angular/platform-browser": "~19.2.17", "@angular/platform-browser-dynamic": "~19.2.17", "@angular/router": "~19.2.17", "@daily-co/daily-js": "^0.83.1", "@microsoft/signalr": "^8.0.7", "@ng-bootstrap/ng-bootstrap": "~18.0.0", "@ng-select/ng-option-highlight": "^14.9.0", "@ng-select/ng-select": "^14.9.0", "@types/luxon": "^3.6.2", "@uppy/angular": "^0.5.0", "@uppy/core": "^3.0.0", "@uppy/drag-drop": "^3.0.0", "@uppy/progress-bar": "^3.0.0", "@uppy/status-bar": "^3.0.0", "@uppy/xhr-upload": "^3.0.0", "@volo/abp.commercial.ng.ui": "~9.2.4", "@volo/abp.ng.account": "~9.2.4", "@volo/abp.ng.audit-logging": "~9.2.4", "@volo/abp.ng.file-management": "~9.2.4", "@volo/abp.ng.gdpr": "~9.2.4", "@volo/abp.ng.identity": "~9.2.4", "@volo/abp.ng.language-management": "~9.2.4", "@volo/abp.ng.openiddictpro": "~9.2.4", "@volo/abp.ng.saas": "~9.2.4", "@volo/abp.ng.text-template-management": "~9.2.4", "@volo/ngx-lepton-x.core": "~4.2.4", "@volosoft/abp.ng.theme.lepton-x": "~4.2.4", "luxon": "^3.6.1", "marked": "^15.0.0", "ngx-bootstrap": "^19.0.2", "ngx-editor": "^19.0.0-beta.1", "ngx-markdown": "^19.1.1", "posthog-js": "1.257.2", "refiner-js": "^1.2.4", "rxjs": "~7.8.0", "zone.js": "~0.15.0" }, "devDependencies": { "@abp/ng.schematics": "~9.2.4", "@angular-builders/custom-webpack": "^19.0.0", "@angular-devkit/build-angular": "~19.2.17", "@angular-eslint/builder": "~19.2.1", "@angular-eslint/eslint-plugin": "~19.2.1", "@angular-eslint/eslint-plugin-template": "~19.2.1", "@angular-eslint/schematics": "~19.2.1", "@angular-eslint/template-parser": "~19.2.1", "@angular/cli": "~19.2.17", "@angular/compiler-cli": "~19.2.17", "@angular/language-service": "~19.2.17", "@babel/runtime": "^7.28.4", "@types/jasmine": "~3.6.0", "@types/node": "^20.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/parser": "^7.0.0", "eslint": "^8.0.0", "ignore-loader": "^0.1.2", "jasmine-core": "~4.0.0", "karma": "~6.4.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.0.0", "ng-packagr": "~19.2.1", "tslib": "^2.7.0", "typescript": "~5.6.0" }, "resolutions": { "http-proxy-middleware": "3.0.3", "rollup": "4.22.4", "axios": "^1.8.2", "form-data": "^4.0.4", "@nrwl/tao": "19.8.0", "@nrwl/devkit": "19.8.0", "**/@ng-bootstrap/ng-bootstrap": "~18.0.0", "**/ng-zorro-antd": "~19.3.1" } }
Please help me address this issue. Thanks.
4 Answer(s)
-
0
1. Solution
The
NullInjectorError: No provider for InjectionToken CORE_OPTIONS!and the “Cannot find the en locale file” error are both symptoms of the same root cause: Angular is not resolving the correct@abp/*/@volo/*packages (so the DI configuration from@abp/ng.coreis never applied, and the locale files can’t be found).This exact issue is known on ABP 9.x Angular (see Microservice template case) and is fixed by normalizing the TypeScript
pathsso they point tonode_modules.Do the following in your Angular app (the one that contains
app.module.tsyou shared):Edit
tsconfig.jsonof the Angular app (usuallyapps/angular/tsconfig.jsonin microservice templates, or roottsconfig.jsonin single app):Add/merge these
pathsundercompilerOptions:
{ "compilerOptions": { // ...existing options... "paths": { // keep your existing paths, then add/override these: "@abp/*": ["node_modules/@abp/*"], "@volo/*": ["node_modules/@volo/*"] } } }- If you already have
@abp/*or@volo/*entries, make sure they only point tonode_modules/@abp/*andnode_modules/@volo/*, not to any local libs.
Clean and reinstall dependencies
From the Angular project folder:
rm -rf node_modules rm -f package-lock.json yarn.lock # then yarn # or npm install- Rebuild and run
yarn start # or npm startVerify your root module setup
Your
AppModule’s core setup is already correct for ABP 9.2.x:
CoreModule.forRoot({ environment, registerLocaleFn: registerLocale(), }),Once
@abp/ng.coreis correctly resolved fromnode_modules, this will:- Provide
CORE_OPTIONS(fixing theNullInjectorError). - Load the default
enlocale (fixing “Cannot find the en locale file”).
After applying the
pathsfix and reinstalling dependencies, both errors should disappear on a fresh build.
2. Sources
- ABP Angular localization & culture files:
https://abp.io/docs/latest/framework/ui/angular/localization
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "module": "es2020", "lib": [ "es2018", "dom" ], "paths": { "@abp/*": ["node_modules/@abp/*"], "@volo/*": ["node_modules/@volo/*"], "@proxy": [ "src/app/proxy/index.ts" ], "@proxy/*": [ "src/app/proxy/*" ] }, "useDefineForClassFields": false, "skipLibCheck": true, "allowSyntheticDefaultImports": true }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false }, }I tried, but same errors.
-
0
1. Solution
The
CORE_OPTIONSerror is not caused by yourtsconfig.jsonanymore (yourpathslook correct). In ABP Angular, this error is almost always due to version mismatches or an extra CoreModule.forRoot/import. Below is a concrete checklist that fixes the issue in 9.x projects.
A. Normalize all ABP / Volosoft / Angular versions
- In your
package.json, make sure all of these have the same minor version line:
@abp/ng.*→~9.2.4@volo/abp.ng.*→~9.2.4@volosoft/abp.ng.theme.lepton-x→~4.2.4(this is correct for ABP 9.2.x)@volo/ngx-lepton-x.core→~4.2.4@angular/*→ all the same major/minor (one line, e.g. all~18.x.xor all~19.x.x– but all must be identical)
Make sure there is no different version of any of these packages pulled in indirectly; if you see any other version ranges (like
^9.1.xor~9.0.x) for@abp,@voloor@volosoftindependenciesordevDependencies, change them to~9.2.4to match.In a very similar support case, the exact same
CORE_OPTIONSerror disappeared as soon as all@abp/*,@volo/*and the theme package were normalized to the same minor version.- After editing
package.json, fully clear and reinstall:
# in the Angular project folder rm -rf node_modules .angular yarn.lock package-lock.json yarn cache clean || npm cache clean --force yarn # or npm install yarn start # or npm start
B. Ensure
CoreModuleis imported only once withforRootCheck all your Angular modules for
@abp/ng.coreimports.- In
AppModule(root), it must be:
CoreModule.forRoot({ environment, registerLocaleFn: registerLocale(), }),- In all other modules (shared/feature libraries), you must not call
forRoot. If you importCoreModulethere, it should be withoutforRoot:
// ✅ allowed in feature/shared modules import { CoreModule } from '@abp/ng.core'; @NgModule({ imports: [ CoreModule, // WITHOUT .forRoot() // ... ], }) export class SomeFeatureModule {}If you have any other
CoreModule.forRoot(...)in the project (including inside your own libraries), Angular will create a separate injector that does not get theCORE_OPTIONSfrom your mainAppModule, andRestService(from@abp/ng.core) will fail with exactly the error you see.So:
- Search the whole solution for
CoreModule.forRootand keep it only inAppModule. - Replace any other occurrences with just
CoreModule.
C. Double‑check you are not using local/custom ABP Angular package sources
The support context for this error also shows it happens when a project:
- Has local copies of ABP / Volosoft Angular packages, or
- Has
tsconfigpathspointing to those local copies.
You already set:
"paths": { "@abp/*": ["node_modules/@abp/*"], "@volo/*": ["node_modules/@volo/*"], "@proxy": [ "src/app/proxy/index.ts" ], "@proxy/*": [ "src/app/proxy/*" ] }Now verify that:
- There are no other
tsconfig*.jsonfiles (in libs/projects) that override@abp/*or@volo/*to some local folder. - You are not checking in customized ABP/Volosoft Angular package source under your repo and referencing it via
paths.
If you find any path like
"@volo/abp.ng.identity": ["projects/identity/src/public-api.ts"]etc., remove those mappings (or rename your custom libs to a different prefix) so@abp/*and@volo/*always resolve tonode_modules.
D. Fix the “Cannot find the en locale file” error
This is usually resolved automatically once
CoreModule.forRoot+registerLocaleFnrun from the correct@volo/abp.ng.language-managementversion, but verify:- Import and use
registerLocaleexactly like this (which you already do):
import { registerLocale } from '@volo/abp.ng.language-management/locale'; CoreModule.forRoot({ environment, registerLocaleFn: registerLocale(), }),- Ensure the localization assets are copied:
Your
angular.json(or workspace config) app’sassetssection should include ABP localization assets (in a 9.x Angular app this is done by the template). Make sure these lines (or their equivalent) exist for your main app:"assets": [ "src/favicon.ico", "src/assets", { "glob": "**/*", "input": "node_modules/@abp/ng.theme.shared/assets", "output": "/assets" } ]There needs to be an
enlocale JSON under/assets(e.g./assets/abp-localization/en.jsonor similar). If the assets from@abp/ng.theme.sharedare not copied, you get the “Cannot find the en locale file” error.Rebuild after any change to
angular.json:yarn start --configuration development # or just yarn start (depending on your setup)Once the versions are normalized,
CoreModule.forRootis only inAppModule, and localization assets are in place, both:NullInjectorError: No provider for InjectionToken CORE_OPTIONS!Cannot find the en locale file.
should be resolved on a clean build.
2. Sources
- ABP Angular Localization (adding cultures & locale files)
https://abp.io/docs/latest/framework/ui/angular/localization
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
- In your
-
0
Support team, please.