gpt4 book ai didi

json - 调用函数 'makeDecorator' ,不支持函数调用

转载 作者:太空狗 更新时间:2023-10-29 18:15:42 25 4
gpt4 key购买 nike

由@alexzuza 解决。请参阅下面他的回答 - 大起大落!基本上,从 ng2-opd-popup 文件夹中删除 node_modules 文件夹,并编辑 src/tsconfig.app.json 以匹配路径。另请参阅评论以获取 rimraf 设置的链接,以自动排除 node_modules 与 npm install 一起安装。

我收到这个错误:

ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function

找到的解决方案here , 不工作 - 我正在运行 angular v. 4.3。

package.json:

PopupModule.forRoot(),

tsconfig.json:

"paths": {
"@angular/*": ["node_modules/@angular/*"]
},

tsconfig.json:

{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"paths": {
"@angular/common": ["../node_modules/@angular/common"],
"@angular/compiler": ["../node_modules/@angular/compiler"],
"@angular/core": ["../node_modules/@angular/core"],
"@angular/forms": ["../node_modules/@angular/forms"],
"@angular/platform-browser": ["../node_modules/@angular/platform-browser"],
"@angular/platform-browser-dynamic": ["../node_modules/@angular/platform-browser-dynamic"],
"@angular/router": ["../node_modules/@angular/router"],
"@angular/http": ["../node_modules/@angular/http"]
},
"lib": [
"es2017",
"dom"
]
}
}

tsconfig.app.json:

{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"paths": {
"@angular/*": ["../node_modules/@angular/*"]
},
"lib": [
"es2017",
"dom"
]
}
}

我的文件结构。 File structure

我正在尝试使用的包:ng2-opd-popup

有人为此找到了解决方案,或者可能使用了更好的软件包?

最佳答案

更改 src/tsconfig.app.json 如:

{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [],
"paths": {
"@angular/*": ["../node_modules/@angular/*"] <=== add this
}
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}

您应该使用 .. 因为 baseUrl 指的是 src 文件夹

https://github.com/alexzuza/angular-cli-make-decorator-fix

它应该适用于 aot,但对于 jit 模式,您必须删除 node_modules/ng2-opd-popup/node_modules 文件夹

enter image description here

关于json - 调用函数 'makeDecorator' ,不支持函数调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46778302/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com