0

这似乎是目前相当普遍的问题。请看这里这里

这个枚举为我抛出了异常:

export enum UserRole {
  CareGiver = 0,
  CareReceiver = 1
}

错误是:

ERROR in Illegal state: symbol without members expected, but got {"filePath":"C:/Users/William-Work/Desktop/findchildcare/src/app/shared/enums/user_role_enum.ts","
le","members":["CareGiver"]}.

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/components/app/app.module.ngfactory' in 'C:\Users\William-Work\Desktop\findchildcare\src'
 @ ./src/main.ts 3:0-89
 @ multi ./src/main.ts

有人可以澄清一下我的枚举声明是否在 Angular 中受支持?

有人可以为这个问题提供解决方案吗?

我的 package.json 包含:

"@angular/animations": "^4.1.3",
    "@angular/common": "^4.1.3",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/forms": "^4.1.3",
    "@angular/http": "^4.1.3",
"@angular/platform-browser": "^4.1.3",
    "@angular/platform-browser-dynamic": "^4.1.3",
"@angular/cli": "^1.1.2",
    "@angular/compiler-cli": "^4.1.3",
    "@angular/language-service": "^4.1.3",

我也试过这个 4.0.0 和 4.3.0,同样的问题。

4

1 回答 1

1

正如 janousek 在这里提到的,由于这段代码在 Angular 中发生了错误:

// Stop simplification at builtin symbols or if we are in a reference context
if (expression === self.injectionToken || expression === self.opaqueToken ||
    self.conversionMap.has(expression) || references > 0) {
    return expression;
}

修复将是降级到 4.2.X 版本,例如 4.2.6

于 2017-08-01T12:32:22.643 回答