Universal: Angular 9 + Firebase => Error: Can't resolve all parameters for ApplicationModule: (?).

Created on 1 Apr 2020  Β·  13Comments  Β·  Source: angular/universal

🐞 Bug report

What modules are related to this issue?

  • [ ] aspnetcore-engine
  • [ ] builders
  • [ ] common
  • [ β€’ ] express-engine
  • [ ] hapi-engine
  • [ ] module-map-ngfactory-loader

Is this a regression?


Yes, the previous version in which this bug was not present was in Angular 8

Description

After upgrading project to Angular 9, SSR does not work. I've updated the server.ts file according to @angular/fire git root sample to no avail.

πŸ”¬ Minimal Reproduction

Please find the repo of project for debugging here β†’

https://github.com/mazlano27/repro-app-3-SSR-Angular9-Firebase

Please run npm run publish to publish SSR to web using firebase hosting + functions

The error can be found at β†’

https://e-commerce-37ecb.firebaseapp.com/

Thank you for your assistance and guidance in advance

Most helpful comment

Closing as solved. Thanks to @hiepxanh and @tarasmatsyuk

All 13 comments

I fix your project and push it on here, please review the change and try it again:
https://github.com/hiepxanh/fix-ssr/commit/0a523d1a624f3aafea15f2e36920cf0bac0f6ae4

project link: https://github.com/hiepxanh/fix-ssr

have issues "project target does not exists" but fixed it follow this answer "https://stackoverflow.com/a/60983433/5992468"

I fix your project and push it on here, please review the change and try it again:
hiepxanh/fix-ssr@0a523d1

project link: https://github.com/hiepxanh/fix-ssr

have issues "project target does not exists" but fixed it follow this answer "https://stackoverflow.com/a/60983433/5992468"

@hiepxanh I've tried to download the fixed project and run β†’

npm run build:ssr
npm run serve:ssr

and I still get the error β†’

Error: Can't resolve all parameters for ApplicationModule: (?). at syntaxError (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:5975:17) at CompileMetadataResolver._getDependenciesMetadata (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25998:35) at CompileMetadataResolver._getTypeMetadata (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25890:26) at CompileMetadataResolver.getNgModuleMetadata (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25758:24) at CompileMetadataResolver.getNgModuleSummary (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25565:35) at /Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25679:51 at Array.forEach (<anonymous>) at CompileMetadataResolver.getNgModuleMetadata (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25667:49) at CompileMetadataResolver.getNgModuleSummary (/Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25565:35) at /Users/Azlan_Mac/Desktop/Dev/fix-ssr-master/dist/server.js:25652:55

@hiepxanh - what could I be missing? I have a few projects in production and would like to upgrade them to v9 for the performance boost.

Thank you in advance

add import 'reflect-metadata' in the first line of server.ts

add import 'reflect-metadata' in the first line of server.ts

@tarasmatsyuk Just tried your suggestion. Upon serving the SSR application, the following error is thrown β†’

Error: ENOENT: no such file or directory, open 'app.component.html'

@mazlano27 I had the same error.
Please check my answer on StackOverflow. Issue
You have to change your builder to this "builder": "@angular-devkit/build-angular:browser" if you use "@angular-devkit/custom-webpack:browser".
Please try suggestion and say if it works.

@mazlano27 also do not use "webpack --config webpack.server.config.js --progress --colors in build

@mazlano27 I had the same error.
Please check my answer on StackOverflow. Issue
You have to change your builder to this "builder": "@angular-devkit/build-angular:browser" if you use "@angular-devkit/custom-webpack:browser".
Please try suggestion and say if it works.

@tarasmatsyuk I'm already using "builder":"@angular-devkit/build-angular:browser"

I've also installed β†’

And still getting the same error β†’
Error: ENOENT: no such file or directory, open 'app.component.html'

:(

@mazlano27 also do not use "webpack --config webpack.server.config.js --progress --colors in build

If I dont use ""webpack --config webpack.server.config.js --progress --colors" in build - how can I test the server? Isn't this compiling the server.ts to server.js?

@mazlano27 how do you run your production build?

@mazlano27 also do not use "webpack --config webpack.server.config.js --progress --colors in build

If I dont use ""webpack --config webpack.server.config.js --progress --colors" in build - how can I test the server? Isn't this compiling the server.ts to server.js?

@tarasmatsyuk I get what you mean now - after working backwards and changing the settings to see what worked and what didn't - I realised that angular builder was compiling server.ts to main.js in dist/project/server folder.

I also removed the "--bundleDependencies none" flag from the build command that seemed to have resolved some other issues. Thank you @tarasmatsyuk and @hiepxanh

Closing as solved. Thanks to @hiepxanh and @tarasmatsyuk

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moczix picture moczix  Β·  5Comments

MrCroft picture MrCroft  Β·  3Comments

jeffwhelpley picture jeffwhelpley  Β·  4Comments

inorganik picture inorganik  Β·  4Comments

mmeylan picture mmeylan  Β·  4Comments