【发布时间】:2019-03-21 08:31:42
【问题描述】:
我按照 Universal 的 Angular 教程进行操作: https://angular.io/guide/universal
我尝试使用以下方式安装 Universal:
ng add @nguniversal/express-engine --clientProject angular.io-example
好吧,运行良好的代码不会返回任何错误。但它不会像它假设的那样生成以下任何文件:
main.server.ts
tsconfig.server.json
app.server.module.ts
server.ts
webpack.server.config.js
这里是 package.json:
{
"name": "angular-io-example",
"version": "1.0.0",
"private": true,
"description": "Example project from an angular.io guide.",
"scripts": {
"lint": "tslint ./src/**/*.ts -t verbose",
"start": "ng serve",
"test": "ng test",
"build": "ng build --prod",
"e2e": "ng e2e",
"ng": "ng"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/animations": "^7.1.0",
"@angular/common": "^7.1.0",
"@angular/compiler": "^7.1.0",
"@angular/core": "^7.1.0",
"@angular/forms": "^7.1.0",
"@angular/http": "^7.1.0",
"@angular/platform-browser": "^7.1.0",
"@angular/platform-browser-dynamic": "^7.1.0",
"@angular/router": "^7.1.0",
"@angular/upgrade": "^7.1.0",
"@nguniversal/express-engine": "^7.1.1",
"angular-in-memory-web-api": "github:brandonroberts/in-memory-web-api-bazel#50a34d8",
"core-js": "^2.5.4",
"rxjs": "^6.3.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.11.0",
"@angular/cli": "^7.1.0",
"@angular/compiler-cli": "^7.1.0",
"@angular/platform-server": "^7.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.4",
"@types/node": "~8.9.4",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.2",
"lodash": "^4.16.2",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.1"
},
"repository": {}
}
那么,文档是否缺少某些内容?还是我错过了什么?
【问题讨论】:
-
这绝对是依赖项的问题,因为我首先在我的项目中使用我的依赖项尝试了它并且它工作了,然后我用你的依赖项尝试了它并且它没有工作。