How to build and deploy Angular Universal app?
Hello
,
We are using latest release of Angular Universal 9 with ivy (next-gen compatibility compiler) but we have an unexpected problem when we tried to build and deploy the app.
We launch Ivy compilation in postinstall in sync mode script in order to avoid out of memory error, but the build doesn’t works…
How to deploy our application quickly without memory error ?
We used “L” plan with 6Gb of Ram, it’s 3x more than our older PaaS system.
I provide most information about it, below :
Build Hook
yarn install
yarn run build:ssr:dev
The command build:ssr:dev launch webpack compilation :
ng run website:build:dev && ng run website:server:dev
The website will be compiled to the dist directory but this is currently not working :
Build output error log
$ ng run website:build:dev && ng run website:server:dev
Generating ES5 bundles for differential loading...
W: An unhandled exception occurred: Call retries were exceeded
W: See "/tmp/ng-1pShkt/angular-errors.log" for further details.
W: error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The file /tmp/ng-1pShkt/angular-errors.log is not available, so I can’t debug log.
How to see Angular build error log ?
How to build Angular application ? (Your documentation is only for AngularJS and it’s an old version, completely differente of Angular “next gen”).
Thanks for your help 
Comments
Hi Lith,
Please try adding the following to the end of your build hook to view this build error.
cat /tmp/*/angular-errors.logHello @jared-wright,
Thank you for your answer !
I’ve tried our solution to read error log, but the content is bit limited…
Does it possible to have the hardware description of the Platform.sh CI ?
This error occurs with Angular sometimes because of memory limit.
Do you know if someone has already use (with success) Angular Universal on Platform.sh ?
Thanks
Hi Lith,
I would check out template and example projects;
https://github.com/platformsh-templates/
https://github.com/platformsh-examples/
I would also recommend adjust your build to just perform
ng run website:build:devand start your applicationng run website:server:devusing the start command. https://docs.platform.sh/languages/nodejs.html#configurationThe issue may be that you are starting your application inside the build container.
If you continue to have issues, I would recommend creating a support ticket, so we can check your project and .platform.app.yaml.
Thanks.
Platform.sh templates and examples doesn’t provide information for an Angular project for now.
Concerning the
buildandstartpart, I will try to explain how Angular Universal works, description below.We are using Angular Universal, so we use Webpack to compile
serverandbrowserfiles :I’ve separate the build in two “run”, first, we build the
serverfiles (server side) :The second part build the
browserfiles (client side) :All files build with this command create a
distfolder with the following tree :The server part seems to be correctly build but the browser part failed in mid-build with the error previously provided.
Then, we launch the
startcommand withpm2like this :I’ve also wrote a ticket to support in order to have some technical help with our configuration files
Thanks !
Hi @Lith
I am trying to deploy an angular project too and I was wondering if you did succeed to build your angular platform.sh
If so, could you publish there the solution you have found to help beginners to find out the good way ?
Thanks in advance and best regards
Jean-François
Hi @jfvallet,
Unfortunately, Platform.sh has never found a solution to help me to deploy my Angular SSR application.
I’ve finally choose an other PaaS system, but I can’t name it here.
I’ve try during a month many solutions, support has(after two weeks) try to help me, but Platform.sh has been created initially for manage PHP applications, so this solution is clearly unadapted for Node.JS applications.
Thanks,
Hi Lith,
Sorry to read that,
Thanks a lot for your response
Bests regards
Oh. I discovered this late. The code in the original message is too complicated and unncessary.
Running a universal singular App:
.platform.app.yaml:Please sign in to leave a comment.