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

标签 angular typescript node-modules jsoneditor

所以,我正在做一个 Angular 项目
最近我在运行 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"
  }
}

任何帮助表示赞赏。

最佳答案

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

关于angular - node_modules/ang-jsoneditor/jsoneditor/jsoneditor.component.d.ts(13,9) 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61751256/

相关文章:

javascript - 如何理解类型 `new (...args: any[]) => any`

javascript - 从html访问名称上带点的属性

angular - 如何配置 tslint 以检查 Angular2 中的 no-unused-variable

angular - 如何在 Angular 5 中验证和关闭 bootstrap 3 模态形式?

angular - 从 ng 服务中排除文件夹

javascript - Nodejs 模块导出困惑

javascript - 如何删除 LokiJS 中的集合

Angular:不推荐使用 create:改用 new Observable()

typescript - 具有静态工厂的抽象父类的子类的类型

typescript - 如何同时导出多个命名空间?