无效的规则结果:Function()

时间:2019-06-13 07:04:03

标签: javascript angular typescript angular-cli

我正在按照angular official site的指示将6号角更新为7号角。

在更新会话期间:
我输入了用于更新v7的angular / cli和core的命令
$ ng update @angular/cli@v7 @angular/core@v7

更新后,我得到了Invalid rule result: Function()

这是命令提示符输出:

added 106 packages from 85 contributors, removed 5 packages, updated 5 packages, moved 1 package and audited 36489 packages in 39.604s
found 18 vulnerabilities (12 low, 1 moderate, 5 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Invalid rule result: Function().

有人知道我为什么收到消息吗?

这是package.json文件中的依赖项。

"dependencies": {
    "@angular/animations": "^8.0.0",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^8.0.0",
    "@angular/compiler": "^8.0.0",
    "@angular/core": "^8.0.0",
    "@angular/forms": "^8.0.0",
    "@angular/http": "^6.0.3",
    "@angular/material": "^7.3.7",
    "@angular/platform-browser": "^8.0.0",
    "@angular/platform-browser-dynamic": "^8.0.0",
    "@angular/router": "^8.0.0",
    "core-js": "^2.5.4",
    "hammerjs": "^2.0.8",
    "ngx-loading": "^3.0.1",
    "rxjs": "6.5.2",
    "underscore": "^1.9.1",
    "zone.js": "^0.9.1"
},
"devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "~7.3.9",
    "@angular/compiler-cli": "^8.0.0",
    "@angular/language-service": "^8.0.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "bootstrap-sass": "^3.3.7",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-scss-preprocessor": "^3.0.0",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~3.4.5"
}

1 个答案:

答案 0 :(得分:2)

我花了很多时间来解决这个问题。与几乎所有这些Angular Upgrade错误一样,将您的解决方案的Angular依赖项升级到同一主要版本(在我们的情况下为6)内的最高版本是非常值得的。这应该是安全的,并且会引入Angular团队的所有补丁。

我将我的开发依赖项中的Angular CLI从"@angular/cli": "6.0.3",升级到"@angular/cli": "6.2.9",。在撰写本文时,这是同一主要版本中最新的受支持版本。您可以使用以下命令执行此操作:

ng update @angular/cli@6.2.9

此后,我可以运行ng update @angular/cli@7 @angular/core@7而不会遇到错误“无效的规则结果:Function()。”