首页 文章

属性'withServerTransition'在'typeof BrowserModule'类型上不存在 . )

提问于
浏览
0

使用角度通用1.0.0-alpha.universal

我使用角度通用cli创建了新的应用程序 .

新的测试应用程序 - 通用

package.json

{
  "name": "test-app",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ung serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ung test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.2.3",
    "@angular/compiler": "2.2.3",
    "@angular/core": "2.2.3",
    "@angular/forms": "2.2.3",
    "@angular/http": "2.2.3",
    "@angular/platform-browser": "^2.2.3",
    "@angular/platform-browser-dynamic": "2.2.3",
    "@angular/platform-server": "^2.2.3",
    "@angular/router": "3.2.3",
    "@ngx-universal/state-transfer": "^4.0.1",
    "angular2-express-engine": "2.1.0-rc.1",
    "angular2-flash-messages": "^1.0.8",
    "angular2-jwt": "^0.2.3",
    "angular2-platform-node": "2.1.0-rc.1",
    "angular2-universal": "2.1.0-rc.1",
    "angular2-universal-polyfills": "2.1.0-rc.1",
    "bcryptjs": "^2.4.3",
    "bootstrap": "^3.3.7",
    "compression": "1.6.2",
    "core-js": "^2.4.1",
    "cors": "^2.8.4",
    "express": "^4.14.0",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jsonwebtoken": "^8.1.0",
    "mongoose": "^4.13.1",
    "passport": "^0.4.0",
    "passport-jwt": "^3.0.0",
    "passport-local": "^1.0.0",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@angular/compiler-cli": "2.2.3",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "@types/body-parser": "0.0.29",
    "@types/compression": "0.0.29",
    "@types/cookie-parser": "^1.3.29",
    "@types/express": "^4.0.29",
    "@types/express-serve-static-core": "^4.0.29",
    "@types/mime": "0.0.28",
    "@types/serve-static": "^1.7.27",
    "universal-cli": "1.0.0-alpha.universal.3",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.0.2",
    "typescript": "~2.0.3"
  }
}

我想在app.browser.module.ts文件中添加以下browserModule

BrowserModule.withServerTransition({appId:'test-app'})

添加此脚本后,我得到以下错误 .

Uncaught Error: Module build failed: Error: E:/projects/Angular2/test-app/src/app/app.browser.module.ts (32,19): Property 'withServerTransition' does not exist on type 'typeof BrowserModule'.)
    at _checkDiagnostics (E:\projects\Angular2\test-app\node_modules\@ngtools\webpack\src\loader.js:115:15)
    at E:\projects\Angular2\test-app\node_modules\@ngtools\webpack\src\loader.js:140:17
    at 
    at _checkDiagnostics (E:\projects\Angular2\test-app\node_modules\@ngtools\webpack\src\loader.js:115:15)
    at E:\projects\Angular2\test-app\node_modules\@ngtools\webpack\src\loader.js:140:17
    at 
    at Object.433 (http://localhost:4200/client.bundle.js:83:7)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.334 (http://localhost:4200/client.bundle.js:29:82)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at Object.624 (http://localhost:4200/client.bundle.js:171:18)
    at __webpack_require__ (http://localhost:4200/inline.bundle.js:53:30)
    at webpackJsonpCallback (http://localhost:4200/inline.bundle.js:24:23)
    at http://localhost:4200/client.bundle.js:1:1

链接:https://github.com/angular/angular-cli/issues/8476

1 回答

相关问题