所以,我正在做一个 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 版本不兼容。另外,我尝试安装最新版本的 jsoneditor
和 ang-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/