question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on npm run serve:ssr

See original GitHub issue

Describe the bug I’m trying to build and serve a local app in ssr mode but npm run server:ssr crash.

To Reproduce Steps to reproduce the behavior:

  1. npm install angular-oauth2-oidc --save
  2. add OAuthModule.forRoot() on AppModule
  3. npm run build:ssr && npm run serve:ssr or npm run dev:ssr

Expected behavior Node Express server listening on http://localhost:4000

Additional context ReferenceError: Document is not defined at Module../node_modules/angular-oauth2-oidc/fesm2015/angular-oauth2-oidc.js

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:16
  • Comments:36 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
Exocompcommented, May 5, 2020

I created a new Angular 9 project and added SSR, keeping everything default.

Then as a test, I injected the DOCUMENT token in AppComponent and use it in ngOnInit(). I could not reproduce the problem.

However, as soon as I added angular-oauth2-oidc and OAuthModule.forRoot in AppModule I got the error (Document is not defined) on build.

Seems to me there is something specific with angular-oauth2-oidc. If I get some more time I will do some more testing.

5reactions
PandaaAgencycommented, May 20, 2020

still no news about this issue ? i’ve tried some fixes on my side but without any luck yet …

Read more comments on GitHub >

github_iconTop Results From Across the Web

$npm run server error - node.js - Stack Overflow
I think the command you're trying to run is: npm run serve. Not: npm run server.
Read more >
Getting this error when I run "npm run server" #19362 - GitHub
Hello! So, the way npm run server works is that it looks in your current package.json for a defined "server" ...
Read more >
http-server - npm
A simple zero-configuration command-line http server. Latest version: 14.1.1, last published: 7 months ago. Start using http-server in your ...
Read more >
15 Common Error Codes in Node.js and How to Fix Them
js and npm ), or when you try to run a server on a port lower than 1024. fs.readFile('/etc/sudoers' ...
Read more >
Fiori npm run start, server instantly ends without error
Hi there, in past we had success with installing VSCode and Fiori Tools but we discover issues with fresh installation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found