调用函数“ makeDecorator”,不支持函数调用

bli*_*one 3 json simplemodal npm typescript angular

由@alexzuza解决。请在下面查看他的答案-大麻烦!基本上,从ng2-opd-popup文件夹中删除node_modules文件夹,然后编辑src/tsconfig.app.json使其与路径匹配。另请参阅注释,以获取rimraf设置的链接,以自动从npm install中排除node_modules。

我收到此错误:

ERROR中的ERROR遇到静态解析符号值的错误。调用函数“ makeDecorator”,不支持函数调用。考虑使用对导出函数的引用替换函数或lambda

此处找到的解决方案不起作用-im running angular v。4.3。

package.json:

PopupModule.forRoot(),
Run Code Online (Sandbox Code Playgroud)

tsconfig.json:

"paths": {
  "@angular/*": ["node_modules/@angular/*"]
},
Run Code Online (Sandbox Code Playgroud)

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"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

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"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我的文件结构。 档案结构

我要使用的软件包:ng2-opd-popup

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

yur*_*zui 5

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"
  ]
}
Run Code Online (Sandbox Code Playgroud)

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

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

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

在此处输入图片说明