当前位置: 首页 > 知识库问答 >
问题:

类型“typeof BrowserModule”上不存在属性“withServerTransition”。)

羊和光
2023-03-14

我使用的是角度通用1.0。0-α。普遍的3.

新的测试应用程序--通用

{
  "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"
  }
}

BrowserModule.with服务器转换({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个答案

闽涵蓄
2023-03-14

我认为是在角4中添加的。升级到角4或5如果你正在开始一个新的项目

v2文档https://v2.angular.io/docs/ts/latest/api/platform-browser/index/BrowserModule-class.html

v4文档https://v4.angular.io/api/platform-browser/BrowserModule

 类似资料:
  • 我使用的是完全修补过的Visual Studio 2013。我正在尝试使用JQuery、JQueryUI和JSRender。我也在尝试使用打字。在ts文件中,我得到如下错误: 类型“{}”上不存在属性“fade div”。

  • 我试图在登录过程后获得连接的用户模型, 首先,在CanActivate guard检查了带有用户JSON对象的本地存储并发现该对象为空之后,用户将重定向到“/login”URL 然后用户登录并重定向回根URL“/”,在连接过程中我使用AuthService,它将从服务器返回的用户对象保存在用户模型中 这是我的守卫:

  • 升级到Angular 6.0和Rxjs到6.0后,我收到以下编译错误:

  • 获取错误:(类型窗口中不存在属性“MktoForms2”

  • 我试图在TypeScript中使用“时刻-持续时间格式”,但即使它有效,webpack仍不断抱怨它无法在线找到“格式”方法: 这里是package.json tsconfig.json: 在(angular2)组件中: 我也试过了 但这并不能改变什么: [at-loader]./src/app/组件/建筑/商店/shop.component.ts:190中的错误:81 TS2339:属性“格式”在

  • 嗨,我正在使用Angular 2 final和router 3.0。我想过滤从 我想做的是: 可以是instanceOf,或,但我只想要。但是我得到一个错误

  • 我得到这个错误: 属性'toPromise'不存在于类型'观察'. any中

  • 在Angular 2使用Http服务的文档页面上,有一个示例。 我克隆了angular2 webpack初学者项目,并自己添加了上述代码。 我导入使用 我假设属性也被导入(起作用)。查看了rxjs.beta-6的更改日志,没有提到任何关于的内容。