Topic: Angular build errors
Frank Kreutzer asked 5 years ago
When trying to build or serve my angular application, the console outputs the following and for many many more components:
ERROR in node_modules/ng-uikit-pro standard/lib/free/buttons/checkbox.directive.d.ts:19:19 - error TS1086: An accessor cannot
be declared in an ambient context.
19 protected get trueValue(): boolean;
What is causing this and how do I go about fixing this?
Arkadiusz Idzikowski staff answered 5 years ago
In package.json you have probably something like this:
"ng-uikit-pro-standard": "git+https://oauth2:TOKEN@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git"
When you use npm install
command, the latest version of ng-uikit-pro-standard (currently 9.0.0) will be downloaded automatically from gitlab server. You can add hash with tag number to this command to download only specific version. For example to always use latest version compatible with Angular 8, you can modify your dependency like this:
`"ng-uikit-pro-standard": "git+https://oauth2:TOKEN@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git#8.10.1"
You probably reinstalled dependencies only in one project and the second project still use MDB Angular 8.x.x.
kiran mudili commented 5 years ago
Hi I am getting the same error, But I want to use free version, please let me know how to resolve it
Arkadiusz Idzikowski staff commented 5 years ago
If you use Angular 8 in your project, you need to install older version of MDB Angular, for example:
npm install angular-bootstrap-md@8.10.1
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.0.0
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Arkadiusz Idzikowski staff commented 5 years ago
Did you update the Angular version in your project with automatic migration tools (ng update)? Please make sure you use Angular 9 and Typescript 3.7.5.
Frank Kreutzer commented 5 years ago
@Arkadiusz Idzikowski The project is Angular version 8.2.3. Do I need to update the project to 9? I have another project with the same Angular version but not getting these errors. I'm using the Gitlab token.
Frank Kreutzer commented 5 years ago
After following the update guide for Angular 9, these errors have gone away.
Frank Kreutzer commented 5 years ago
@Arkadiusz Idzikowski But one last question: why would one of my Angular 8 projects need to seemingly be updated to fix these breaking changes, and yet another not while both using MDB Angular Pro from the Gitlab token?