Angular Compiler Error (TS2307) after Downloading Account.Pro Source Code (v10.4.1)
Message
Hi ABP Support Team,
I am facing a blocker with the Angular application in my ABP Commercial project (v10.4.1) after downloading the source code for the Volo.Abp.Account.Pro module.
🚨 The Issue
When running the Angular compiler (npm start or ng build), it fails with the following error inside the newly downloaded module projects:
X [ERROR] TS2307: Cannot find module '@abp/ng.core' or its corresponding type declarations. [plugin angular-compiler]
../modules/Volo.Abp.Account.Pro/angular/projects/account/admin/config/src/account-admin-config.module.ts:1:27:
1 │ import { CoreModule } from '@abp/ng.core';
📂 Context & Configuration
ABP Version
- 10.4.1 (Commercial)
Current Situation
I have other local modules (e.g., a custom finance module) under the ../modules/ directory, and they are working completely fine without any compilation or path mapping issues.
Module Structure
The downloaded Volo.Abp.Account.Pro module contains a projects folder with account and account.core. Each sub-project contains its own isolated tsconfig.lib.json which has:
{
"types": []
}
and extends from a local base configuration.
Main Application tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"skipLibCheck": true,
"target": "ES2022",
"module": "ES2022",
"paths": {
"@volo/abp.ng.account": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/src/public-api.ts"
],
"@volo/abp.ng.account/admin": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/admin/src/public-api.ts"
],
"@volo/abp.ng.account/public": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/public/src/public-api.ts"
],
"@volo/abp.ng.account/admin/config": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/admin/config/src/public-api.ts"
],
"@volo/abp.ng.account/public/config": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/public/config/src/public-api.ts"
],
"@volo/abp.ng.account/public/proxy": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account/public/proxy/src/public-api.ts"
],
"@volo/abp.ng.account.core": [
"../modules/Volo.Abp.Account.Pro/angular/projects/account.core/src/public-api.ts"
]
},
"useDefineForClassFields": false
}
}
🛠️ What I Have Tried So Far
- Explicitly mapped
@abp/ng.coreto target the rootnode_modules/@abp/ng.coreinside the maintsconfig.json. - Cleared the
.angularcache folder and rebuilt/reinstallednode_modules. - Modified the sub-project's internal
tsconfig.jsonfiles to resolve paths manually.
However, the isolated compilation structure of Account Pro combined with "moduleResolution": "bundler" prevents it from tracking the global packages correctly.
❓ Question
Since this issue is isolated strictly to the Account Pro workspace architecture and does not affect my other source-code modules, could you please guide me on the official/correct way to resolve:
- Path mappings for ABP Angular packages within downloaded commercial modules.
- Required peer dependencies for Account Pro source-code projects.
- Any additional workspace configuration needed when integrating the module into an existing Angular application.
Any guidance would be greatly appreciated.
Best regards,
Abdulsalm Alshuaibi
2 Answer(s)
-
0
The root cause is that the downloaded Account.Pro Angular libraries are being compiled as separate Angular library projects, and with Angular’s newer builder +
"moduleResolution": "bundler", TypeScript can fail to resolve workspace-external dependencies (like@abp/ng.core) consistently when you reference module source viatsconfig.paths(e.g., pointing to../modules/.../projects/.../src/public-api.ts). This frequently manifests asTS2307(module not found) or related Angular compiler/type-check issues in modular development scenarios.The officially working approach (and the one that avoids this entire class of resolution problems) is to not compile these module projects through
tsconfig.pathspointing to their source. Instead, use one of these two approaches:Option A (recommended): Consume the module UI as a built package (
file:) instead ofpaths- Build the Account.Pro Angular libraries (the projects under
../modules/Volo.Abp.Account.Pro/angular/projects/...) so they produce theirdistoutputs. - In your main Angular app, reference them via
package.jsonusingfile:(or a local tarball), rather thantsconfig.jsonpathsintosrc/public-api.ts. - Remove (or at least stop using) the
pathsentries that point into../modules/.../projects/.../src/....
This ensures there is one consistent dependency graph resolved from your main app’s
node_modules.Option B: Use symlinks so module projects resolve dependencies from the main app’s
node_modulesIf you must develop the module source “in place” inside the same repo, use a symlink strategy so the module library projects resolve the same physical
@abp/*packages as the main app:- Avoid “redirecting” ABP framework packages with
pathsmappings (mapping@abp/ng.coremanually is a common way to end up with inconsistent resolution). - Ensure the library projects under
../modules/.../angular/projects/...resolve dependencies from the main app’sangular/node_modulesby symlinking (so they don’t behave like isolated workspaces with their own resolution roots).
- Build the Account.Pro Angular libraries (the projects under
About peer dependencies: Account.Pro Angular source projects expect the ABP Angular packages (like
@abp/ng.core) to be available from the consuming app’snode_modules(same versions as your solution). When the module projects compile “isolated” and can’t see thatnode_modulesconsistently, you hitTS2307. Using Option A or B above fixes that by making dependency resolution consistent.The
"types": []insidetsconfig.lib.jsonis not the core issue here; the problem is primarily the module resolution graph and the way the new builder handlespaths+ library compilation boundaries.
Sources:
- https://abp.io/support/questions/10448
- https://abp.io/docs/latest/framework/ui/angular/quick-start
- https://abp.io/docs/10.0/framework/ui/angular/quick-start
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.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
The TS2307 happens because
account-admin-config.module.tsresolves@abp/ng.corefrom inside../modules/Volo.Abp.Account.Pro/angular/..., and there's nonode_modules/@abpunder that folder yet. The resolver walks up from there and never reaches your main app'snode_modules.The Angular template ships a script for exactly this case. Edit
<your-app>/angular/scripts/symlink-config.ps1and add the module's angular folder to$PackageDirectories:$script:PackageDirectories = @( "../../modules/Volo.Abp.Account.Pro/angular" )Then from
<your-app>/angular/scripts/, run:pwsh ./setup-symlinks.ps1You should see
Linked @angular,Linked @abp,Linked @volo,Linked rxjs,Linked tslibprinted, and the TS2307 will be gone. The default$PackagesToSymlinkarray already covers all the framework packages, so you only need to add the directory path.One more thing: please remove the manual
@abp/ng.corepath mapping you added in your maintsconfig.json. After the symlinks are in place, Angular resolves@abp/ng.corefromnode_moduleson its own — the manual mapping ends up competing with that and can lead to inconsistent resolution.We'll fix this on our side so the path gets added and the symlinks get refreshed automatically when you Import a module or download a Pro module's source. It'll go out in the next ABP Studio release.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)