尝试将Angular Universal添加到现有Angular 6项目中时抛出错误

时间:2019-04-05 19:20:56

标签: angular angular6 angular-universal

我遇到的错误是“无效的规则结果:Function();” 。我目前正在做的是尝试将Angular Universal添加到我的Angular 6项目中。产生此错误的代码是

ng add @nguniversal/express-engine --clientProject artists

现在,可以在本文https://angular.io/guide/universal中找到我要遵循的文档。发生的一切仅是运行以下代码行,并且我想生成文件。实际发生的是代码正在运行,然后在终端中显示一条消息,提示“通过npm安装工具包” ,然后出现“无效的规则结果:Function();”

我想补充一点,在开始遵循该文档之前,我已经完全遵循本文档https://github.com/angular/angular-cli/wiki/stories-universal-rendering,所以我已经有了其中一些文件,这些文件将由Angular Universal生成。 >

所以,我有两个问题。

1。错误无效的规则结果是什么:Function(); 是什么意思,我该如何解决?

2。既然我已经有一些文件可以在运行上述代码后生成,那么这会干扰Angular Universal的安装吗?

这是我的package.json:

{
  "name": "artists",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/platform-server": "^7.2.12",
    "@angular/router": "^6.0.3",
    "@nguniversal/express-engine": "^7.1.1",
    "@nguniversal/module-map-ngfactory-loader": "^7.1.1",
    "@schematics/angular": "^7.3.8",
    "core-js": "^2.5.4",
    "express": "^4.16.4",
    "jquery": "^3.3.1",
    "rxjs": "6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^6.0.3",
    "@angular-devkit/build-angular": "~0.6.8",
    "typescript": "~2.7.2",
    "@angular/cli": "~6.0.8",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "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",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1"
  }
}

0 个答案:

没有答案