Running an Angular2 app on EC2 - node.js

I'd like to run a basic Angular 2 app on an Ubuntu EC2 instance.
In my case, I installed Angular CLI, and created a new site in /var/www
ng new test
then
ng serve --port 8080
It looks like my basic Angular2 app is running fine
** NG Live Development Server is listening on localhost:8080, open your browser on http://localhost:8080 **
Hash: e0094cf33de0e6b8f264
Time: 9090ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.js.map (main) 5.28 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.18 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
I know port 8080 is open in my security groups, because I just ran a basic Node JS app a few minutes ago in /var/www. When I try to go to http://[Public DNS]:8080, Safari says it can't connect. There's also nothing in my apache logs.

Turns out the real issue is this:
https://github.com/angular/angular-cli/issues/6070
I've tried editing the server.js file and running with the --publicHost option, but those aren't working. I'm using non CLI Angular with the default port 3000 and that's working on EC2 (after adding the security group settings).

Related

new angular 8 application return http 400

I am facing a strange error. I am creating new clean angular 8 app and successfully built code but try to open application at localhost:4200 (or any port I changed to) app return http 400
I have added build info. Uninstall node js and re-install it and still same
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 49.4 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 10.1 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
Date: 2019-10-21T10:00:41.976Z - Hash: 8acb354556900c2f8710 - Time: 9192ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.
May be there is something in your server.js file in nodejs app. Are you allowing requests from all urls ? You need to enable Cross Origin Resource Sharing.

How to connect to angular, nodejs http://localhost:4200 in google chrome

I am following the tutorial from https://angular.io/cli, but i am unable to connect to http://localhost:4200 after using the command ng serve from my command prompt.
The page returned the following error: This site can’t provide a secure connection, ERR_SSL_PROTOCOL_ERROR
The project is compiled successfully
I had tried allowing nodejs.exe and chrome.exe to in firewall
I disabled the Proxy Server From the (Settings -> Advance Settings -> Open Proxy Settings -> LAN settings)
I tried telnet cmd>telnet localhost 4200 (successful)
I tried connecting from internet explorer, it worked but there is no content in the webpage.
The following are executed within the windows command prompt following the tutorial:
C:\Users\Ufinity\Desktop\test-angular>ng serve
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 49.4 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.71 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
Date: 2019-09-05T09:55:54.613Z - Hash: 2c73ac9786af94e810bc - Time: 10587ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.
I should be able to connect to http://localhost:4200 and the page should display a welcome to test-angular page.
Solution 1: Use incognito google chrome to go to http://localhost:4200
Solution 2: Make sure you are not connected to any VPN:
Go to developer tools Chrome 3 dots > More tools > Developer tools
Right click on the refresh button > select > Empty Cache and Hard Reload
Then type http://localhost:4200
Go to developer tools
Empty cache and hard reload
Enter http://localhost:4200
Check baseUrl: 'http://localhost:4200/'
in protractor.config.js file

localhost:4200 not working for my angular app

Till yesterday, everything was working good. Using cmd, I type ng serve, go to my browser type localhost:4200 and my website fires up.
Suddenly today, the localhost is not responding. The ng serve is working properly.
Output after typing ng-serve-
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 47.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.7 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.81 MB [initial] [rendered]
Date: 2019-09-05T04:20:41.402Z - Hash: a7331d4e748902ef88b7 - Time: 19033ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
I tried different browsers, tried reinstalling angular, still the problem persists.
The message that I get on my browser is - This site can't be reached.
You can try changing your host and your port, something like this:
ng serve --host 0.0.0.0 --port 5000
Maybe it will help...
With ng serve instead of opening the URL with http://localhost:4200 open with http://0.0.0.0:4200 .
Ok I found the problem.
After Windows Update, the Firewall Settings were messed up. I restored the default settings and now it's working fine.
Moral of the Story: Use Linux!
Before starting your app making every time first compile.
Steps.
Go to your file location in CMS.
And type ng serve and wait.
Then go to localhost:4200

How to solve "Java Failed to write core dump ..." for Rstudio running in EMR

I'm running a data preparation script with Sparklyr on Rstudio (running in EMR). The code exuction crashes and I got this error report I don't understand properly:
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f99b77fb968, pid=12298, tid=0x00007f99b8167940
#
# JRE version: OpenJDK Runtime Environment (8.0_171-b10) (build 1.8.0_171-b10)
# Java VM: OpenJDK 64-Bit Server VM (25.171-b10 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libR.so+0xbe968]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
/proc/meminfo:
MemTotal: 32949048 kB
MemFree: 11480880 kB
MemAvailable: 19345760 kB
Buffers: 455776 kB
Cached: 5598268 kB
SwapCached: 0 kB
Active: 14572612 kB
Inactive: 3704688 kB
Active(anon): 12223280 kB
Inactive(anon): 48 kB
Active(file): 2349332 kB
Inactive(file): 3704640 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 748 kB
Writeback: 0 kB
AnonPages: 12223264 kB
Mapped: 198336 kB
...
I want to know how to fix the problem so my code could run entirely ?
Thanks in advance !

node_modules and Angular issues

I cannot piece the reason for my errors:
PS C:\Users\Zakariah Siyaji\Desktop\AngularAdmin> ng serve
** Angular Live Development Server is listening on localhost: 4200, open your browser on http://localhost:4200/ **
Date: 2018-08-18T23:32:59.066Z Hash: 8230d7de0b0765e109df Time: 9191ms
chunk {main} main.js, main.js.map (main) 2.06 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 691 bytes
[initial] [rendered] chunk {runtime} runtime.js, runtime.js.map
(runtime) 5.4 kB [entry] [rendered] chunk {styles} styles.js,
styles.js.map (styles) 28.3 kB [initial] [rendered] chunk {vendor}
vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]
ERROR in
node_modules/#angular/material/stepper/typings/stepper.d.ts(26,22):
error TS2415: Class 'MatStepper' incorrectly extends base class
'CdkStepper'. Types of property '_stepHeader' are incompatible.
Type 'QueryList' is not assignable to type 'QueryList'.
Type 'ElementRef' is not assignable to type 'FocusableOption'.
Property 'focus' is missing in type 'ElementRef'.
i 「wdm」: Failed to compile.
I deleted node_modules, I did npm install and npm update but neither
of those options fixed the issue. The code is flawless, it is simply
an issue related to node_modules and different packages.

Resources