2

I follow the tutorial from angular for Universal: https://angular.io/guide/universal

I try to install Universal with:

ng add @nguniversal/express-engine --clientProject angular.io-example 

Well, the code running fine doesn't return any error. But it doesn't generate any of following files like it suppose to:

main.server.ts tsconfig.server.json app.server.module.ts server.ts webpack.server.config.js 

Here is 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": {} } 

So, is the documentation missing something? or am I missing something?

1
  • 1
    It's definitely a problem with dependencies because I have tried it first on my project with my dependencies and it worked, then I tried it with your dependencies and it didn't work. Commented Mar 21, 2019 at 9:10

1 Answer 1

4

After few tries I tried to update some dependencies the problem here is located in the typescript version. Change it from typescript: '^3.1.1' to typescript: '^3.2.2'. Then this command should work properly.

ng add @nguniversal/express-engine --clientProject angular.io-example 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much, it does solve the problem, I just don't understand, the tutorial come from the official site, why do they have this error? Also could you explain the error here :-?
I am not sure what caused this. Maybe there is some problem with compatibility or just some bug.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.