Angular node_modules/ang jsoneditor/jsoneditor/jsoneditor.component.d.ts中的错误(13,9)
所以,我在做一个有角度的项目 最近,我在运行Angular node_modules/ang jsoneditor/jsoneditor/jsoneditor.component.d.ts中的错误(13,9),angular,typescript,node-modules,jsoneditor,Angular,Typescript,Node Modules,Jsoneditor,所以,我在做一个有角度的项目 最近,我在运行npm start时开始遇到这个问题。如果复制较旧的节点模块文件夹,但仅当我执行新的npm安装时,我才面临此问题。 我最近在package.json文件中没有看到任何更改。但是当我运行npm start时,我得到了这个错误: 节点中出错\u modules/ang jsoneditor/jsoneditor/jsoneditor.component.d.ts(13,9):错误TS1086:无法在环境上下文中声明访问器。 我试图安装最新版本的typesc
npm start
时开始遇到这个问题。如果复制较旧的节点模块
文件夹,但仅当我执行新的npm安装时,我才面临此问题。
我最近在package.json文件中没有看到任何更改。但是当我运行npm start
时,我得到了这个错误:
节点中出错\u modules/ang jsoneditor/jsoneditor/jsoneditor.component.d.ts(13,9):错误TS1086:无法在环境上下文中声明访问器。
我试图安装最新版本的typescript
,但似乎与我正在使用的angular cli版本不兼容。此外,我还尝试安装了最新版本的jsoneditor
和ang jsoneditor
我不确定这是由于版本不匹配还是由于其他错误
下面是我的包.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
包版本显然带有Angular 7,因为它使用了更高版本的TypeScript,并带有导致错误的。尚未在问题单上发布正式解决方案,但您可以尝试安装与Angular 7兼容的较旧版本的ang jsoneditor
。可能是Typescript-Angular兼容性问题。尝试将“typescript”:“^3.2.4”
替换为“typescript”:“~3.6.0”
(注意:~
而不是^
),然后重新安装npm。@MichaelD如果我使用的是typescript版本3.3~,npm start
会引发与typescript版本兼容的错误。但我使用的是typescript版本3.2.4,请尝试将^3.2.4
替换为~3.2.4
@MichaelD Nope,它不起作用。仍然看到相同的错误。在这种情况下,如果可能的话,请尝试更新角度剪辑。这对我很有效。非常感谢。我将ang jsoneditor
版本降级为1.7.8。