New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Universal server-side rendering Page loading error angular 7 #27486

Open
ayotycoon opened this Issue Dec 5, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@ayotycoon

ayotycoon commented Dec 5, 2018

馃悶 bug report

Affected Package

The issue is caused by package @angular/ ngUniversal

Is this a regression?

I didnt notice this bug in v6

Description

A clear and concise description of the problem...

Angular universal project won't run after compiling. api works but rendering pages gives error, and sometimes the browser just loads infinitely without any result. working with the project in browser only works (ng serve) and working with the apis also works (http://localhost:8080/api).
as a side note i updated this project from v6 and i didn't notice this problem, although i can't say for sure since i mostly worked on the UI so i didn't need to compile as often

馃敩 Minimal Reproduction

https://stackblitz.com/...

馃敟 Exception or Error



Listening on: http://localhost:8080
connected to db
ERROR [Error]
ERROR [Error]
ERROR [Error]
ERROR [Error]



馃實 Your Environment

Angular Version:





Angular CLI: 7.0.4
Node: 10.13.0
OS: win32 x64
Angular: 7.1.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.4
@angular-devkit/build-angular     0.10.4
@angular-devkit/build-optimizer   0.10.4
@angular-devkit/build-webpack     0.10.4
@angular-devkit/core              7.0.4
@angular-devkit/schematics        7.0.4
@angular/cli                      7.0.4
@angular/language-service         7.0.2
@angular/material                 
@ngtools/webpack                  7.0.4
@schematics/angular               7.0.4
@schematics/update                0.10.4
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1

Anything else relevant?

This is not browser specific, i've tested on chrome, edge and fire-fox
//----------------------------------------------
Here is my package.json

"dependencies": {
"@angular/animations": "~7.1.1",
"@angular/cdk": "^7.1.1",
"@angular/common": "~7.1.1",
"@angular/compiler": "~7.1.1",
"@angular/core": "~7.1.1",
"@angular/forms": "~7.1.1",
"@angular/http": "~7.1.1",
"@angular/platform-browser": "^7.1.1",
"@angular/platform-browser-dynamic": "~7.1.1",
"@angular/platform-server": "^7.1.1",
"@angular/router": "~7.1.1",
"@auth0/angular-jwt": "^2.0.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
"@ng-toolkit/universal": "^1.1.42",
"@nguniversal/express-engine": "^7.0.2",
"@nguniversal/module-map-ngfactory-loader": "^7.0.2",
"@types/chart.js": "^2.7.40",
"bcrypt": "^3.0.2",
"chart.js": "^2.7.3",
"core-js": "^2.5.4",
"cors": "~2.8.4",
"dotenv": "^6.1.0",
"iplocate": "^1.0.7",
"jsonwebtoken": "^8.3.0",
"mongoose": "^5.3.8",
"rxjs": "~6.3.3",
"ts-loader": "4.2.0",
"webpack-cli": "^2.1.4",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.0",
"@angular/cli": "~7.0.4",
"@angular/compiler-cli": "~7.1.1",
"@angular/language-service": "~7.0.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"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",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.1"
}

@ngbot ngbot bot modified the milestone: needsTriage Dec 6, 2018

@CaerusKaru

This comment has been minimized.

Member

CaerusKaru commented Dec 7, 2018

Please provide a minimal reproduction repo. This is impossible to diagnose otherwise.

@lapongua

This comment has been minimized.

lapongua commented Dec 12, 2018

I get a similar error... after run project on ssr I get a loop of "Error: Cannot activate an already activated outlet"

@ayotycoon

This comment has been minimized.

ayotycoon commented Dec 12, 2018

For some reason it worked when I cleared my homepage, made it blank and rebuilt it. I have no idea what happened. Other routes worked but the home just wouldn't

@lapongua

This comment has been minimized.

lapongua commented Dec 12, 2018

npm run build:ssr && npm run serve:ssr
Node server listening on http://localhost:4000

The error appears when I access with the browser on: http://localhost:4000

ERROR { Error: Uncaught (in promise): Error: Cannot activate an already activated outlet
Error: Cannot activate an already activated outlet
    at RouterOutlet.activateWith (/home/user/projects/myproject/dist/server.js:156002:19)
    at ActivateRoutes.activateRoutes (/home/user/projects/myproject/dist/server.js:155296:40)
    at /home/user/projects/myproject/dist/server.js:155247:19
    at Array.forEach (<anonymous>)
    at ActivateRoutes.activateChildRoutes (/home/user/projects/myproject/dist/server.js:155246:29)
    at ActivateRoutes.activate (/home/user/projects/myproject/dist/server.js:155171:14)
    at /home/user/projects/myproject/dist/server.js:155101:18
    at SafeSubscriber._next (/home/user/projects/myproject/dist/server.js:23146:21)
    at SafeSubscriber.__tryOrUnsub (/home/user/projects/myproject/dist/server.js:23438:16)
    at SafeSubscriber.next (/home/user/projects/myproject/dist/server.js:23376:22)
    at resolvePromise (/home/user/projects/myproject/dist/server.js:952:31)
    at resolvePromise (/home/user/projects/myproject/dist/server.js:909:17)
    at /home/user/projects/myproject/dist/server.js:1011:17
    at ZoneDelegate.invokeTask (/home/user/projects/myproject/dist/server.js:559:31)
    at Object.onInvokeTask (/home/user/projects/myproject/dist/server.js:7713:33)
    at ZoneDelegate.invokeTask (/home/user/projects/myproject/dist/server.js:558:36)
    at Zone.runTask (/home/user/projects/myproject/dist/server.js:326:47)
    at drainMicroTaskQueue (/home/user/projects/myproject/dist/server.js:733:35)
    at ZoneTask.invokeTask (/home/user/projects/myproject/dist/server.js:638:21)
    at Timeout.ZoneTask.invoke (/home/user/projects/myproject/dist/server.js:623:48)
  rejection: Error: Cannot activate an already activated outlet
    at RouterOutlet.activateWith (/home/user/projects/myproject/dist/server.js:156002:19)
    at ActivateRoutes.activateRoutes (/home/user/projects/myproject/dist/server.js:155296:40)
    at /home/user/projects/myproject/dist/server.

驴someone could help me fix it?
Thanks.

@Gorniv

This comment has been minimized.

Gorniv commented Dec 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment