node_modules / ang-jsoneditor / jsoneditor / jsoneditor.component.d.ts(13,9)中的错误

问题描述 投票:3回答:1

所以,我正在做一个有角度的项目,最近,我在运行npm start时开始遇到此问题。如果仅复制旧的node-modules文件夹,而仅执行新的npm install文件夹,则不会遇到此问题。我最近在package.json文件中没有看到任何更改。但是当我运行npm start时,出现此错误:ERROR in node_modules/ang-jsoneditor/jsoneditor/jsoneditor.component.d.ts(13,9): error TS1086: An accessor cannot be declared in an ambient context.

我尝试安装typescript的最新版本,但似乎与我使用的angular-cli版本不兼容。另外,我尝试安装最新版本的jsoneditorang-jsoneditor

我不确定这是由于某些版本不匹配还是由于其他错误。

这是我的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"
  }
}

感谢您的帮助。

angular typescript node-modules jsoneditor
1个回答
1
投票

您的ang-jsoneditor软件包的版本显然是Angular 7的does not work,因为它使用带有breaking change的更高版本的TypeScript,这会导致错误。尚未在问题单上发布官方解决方案,但您可以尝试安装与Angular 7兼容的较旧版本的ang-jsoneditor

© www.soinside.com 2019 - 2024. All rights reserved.