So, I am working on an angular project and
recently I started to face this issue while running npm start
. I am not facing the issue, if copy the older node-modules
folder but only when I do a fresh npm install
.
I do not see any changes in my package.json file recently. But when I run npm start
, I am getting this error:
ERROR in node_modules/ang-jsoneditor/jsoneditor/jsoneditor.component.d.ts(13,9): error TS1086: An accessor cannot be declared in an ambient context.
I tried to install the latest version of typescript
but seems like that was not compatible with the angular-cli version I am using. Also, I tried to install the latest version of jsoneditor
and ang-jsoneditor
.
I am not sure if this is due to some version mismatch or due to some other error.
Here is a snippet of my package.json
.
{
"name": "Project",
"version": "2.0.0",
"license": "MIT",
"dependencies": {
"@angular/animations": "^7.2.12",
"@angular/cdk": "~7.1.0",
"@angular/common": "^7.2.12",
"@angular/compiler": "^7.2.12",
"@angular/core": "^7.2.12",
"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "^7.3.8",
"@angular/compiler-cli": "^7.2.12",
"ang-jsoneditor": "^1.9.4",
"jsoneditor": "^5.34.0",
"typescript": "^3.2.4"
}
}
Any help is appreciated.
Your version of the ang-jsoneditor
package apparently does not work with Angular 7 because it uses a higher version of TypeScript with a breaking change which is causing the error. No official solution has been posted on the issue ticket yet but you can try to install an older version of ang-jsoneditor
that is compatible with Angular 7.