Angular with Universal不会运行

时间:2017-08-03 06:17:14

标签: angular angular-universal

我是角度4的初学者。我需要角色应用程序与SEO友好。它支持Angular Universal(在ung new或ung init后使用--universal标志),

我创建了一个有角度的通用应用程序。

我试过这种方式。

npm install -g universal-cli
ung new PROJECT_NAME
cd PROJECT_NAME
ung serve

我运行项目时出现此错误

fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
** Universal-cli Development Server is running on http://localhost:4200. **
Hash: 34da1f0a10666443edabf3e29a861661ab204818
webpack: bundle is now VALID
module.js:471
    throw err;
    ^

Error: Cannot find module 'F:\anitha\projects\Angular universal\TestProject\"F:\anitha\projects\Angular'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:505:3

我试图再次删除node_modules我安装npm.But仍然无法正常工作。  这是我的package.json

 {
  "name": "demo",
  "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/router": "3.2.3",
    "@angular/platform-server": "2.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",
    "angular2-express-engine": "2.1.0-rc.1",
    "compression": "1.6.2",
    "express": "^4.14.0",
    "core-js": "^2.4.1",
    "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"
  }
}

我该如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

universal-cli已经过时了。注意包如何使用Angular 2.按照this guide并使用angular-cli代替。