ng serve This page isn't working - javascript

I'm running through the angular-cli tutorial, and the NG Live Development server doesn't seem to launch (No response on http://localhost:8080) with no errors in console. This is a blank project with no code created using:
ng new test-app
cd test-app
ng serve
I've tried ng serve --host 0.0.0.0 ng serve --host 0.0.0.0 --port 4201 with multiple ports. I've made sure there is nothing listening on those ports.
Environment: Windows 10 (1709)
#angular/cli: 1.6.7
#angular-devkit/build-optimizer: 0.0.42
#angular-devkit/core: 0.0.29
#angular-devkit/schematics: 0.0.52
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.9.7
#schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
Is there a log that could provide more information? I haven't been able to find anyone having trouble on this basic step. Cheers.

if you are using docker in your machine try deleting all the files in docker desktop,it worked for me

Related

In VPS with OS Ubuntu 18.04 "apt install nginx" shows libc6 & libcrypt1 error. So, how to install libc6 & libcrypt1 in it?

I am trying to host node app on vps using nginx server. But I am unable to install nginx in ubuntu 18.04 version after apt install nginx shows:
The following packages have unmet dependencies:
nginx : Depends: libc6 (>= 2.28) but 2.27-3ubuntu1.6 is to be installed
Depends: libcrypt1 (>= 1:4.1.0) but it is not installable
E: Unable to correct problems, you have held broken packages.
Anyone face such problem & how do you solve it? I also got problem in nginx.cnf, after nginx -t to check it shows brotil error.
ubuntu nginx installation
node app
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
I want to host node app to serve backend API's. So, I bought VPS from Hostinger website & have installed Ubuntu v18.04 in it. Then I successfully installed nodejs to run nodeapp & pm2 to manage processes. It was successfully running on port 8000. But problem is when I called the API from frontend, shows SSL security error.
So, for that I tried to install nginx but shows error & I guess for SSL nginx server is required. Now I am stuck in nginx installation.
I need some solution from someone who also face same problem.
You should consider upgrading to more recent versions of ubuntu as version 18.04 will reach EOL on April 30, 2023
Otherwise, you may try upgrading packages on your system, as it currently has libc6 version 2.27 while version 2.28 or higher is required.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
if you continue seeing an issue, you may try
sudo apt-get install --no-install-recommends nginx
Actually, I had installed Ubuntu v18.04 with plex control panel. I guess that is giving me the issue.
Now I installed Ubuntu v18.04 only. It is working fine now. I successfully installed nginx and it is running properly.

How to host a Node.js app on AWS EC2 Ubuntu free tier?

I am really new to AWS EC2. I hosted my Express.js on AWS EC2 using PM2.
Here is the current log of EC2 of my app.
I don't know whether this is working or not.
My public IPv4 address is (52.90.33.231).
If Nginx is required, please guide me through its steps because I have no prior experience.
I am also adding the inbound rules here.
http://localhost:5002/questapi
The above url used to give me the following data:
So
52.90.33.231/questapi is the working url.
I would prefer using Docker to run your application in EC2 instead of using PM2, It will be easy for you to migrate your application to any environment irrespective of application dependencies. PM2 is a good deployment tool but the better answer will be DOCKER.
Regarding NGINX, You can use NGINX or APACHE web servers to enable reverse proxy on your Node services to route your 5002 port to 443/80. There also I would suggest using AWS Application load balancer because it will provide the same and easy for you to install SSL certificate using AWS CERTIFICATE MANAGER.
Steps to Docker Node deployment in Ec2
Install DOCKER in your EC2 machine - Follow this reference URL
Clone your NodeJS codebase in the EC2 machine and add Dockerfile in the root folder in your codebase. Below I will add the Dockerfile sample.
Build docker image using this command in your root folder of the project docker build --no-cache -t <your_application_name>:latest .
Run NodeJs docker image using the given command
sudo docker run --name <your_application_name> -itd --net="host"
-e 5002:5002
--restart unless-stopped
<your_application_name>:latest;
Now you can start using the application on <your_instance_public_ip>:5002, Make sure to enable the 5002 port in security group inbound access.
In between, Here I'm adding a reference link to use Aws ALB to hide your EC2 IP address and application port number by using reverse proxying rules.
https://www.clickittech.com/devops/deploy-nodejs-app-to-aws/
DOCKERFILE Sample for NODEJS application
FROM node:14.0
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm#5+)
COPY package.json /usr/src/app/
RUN npm install
# Bundle app source
COPY . .
EXPOSE 5002
CMD [ "node", "server.js" ] # you can add your start command
you should refer to this video (from Brad Traversy) where he deploys the Nodejs application on DigitalOcean droplet using pm2, but for deploying on AWS EC2 you can follow the exact same steps as both use the Ubuntu OS, NGINX and pm2 for configuring the application.
NODEJS DEPLOYING TUTORIAL

Angular project shows blank page on some computers at the same network

I run an angular 2 project with ng serve --host 0.0.0.0 --port 4000 and try to access it from computers on the same network. On some computers it loads perfectly and on some it shows an empty page with no error in the console. I checked the index page html and i see there the title and the icon but no directives on the app-root or the styles in the header.
Thanks for helping :)
try this
ng serve --host 0.0.0.0 --port 4000 --disable-host-check
and be sure that in that computer firewall allow it

Deploy sails.js on Openshift

I'm trying to deploy a sails.js app (sails.js version 0.11) to Openshift.
I'm aware of the previous questions and answers in here for example;
https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6
I followed the steps from that post.
I also created my app via git://github.com/ryanj/nodejs-custom-version-openshift.git so I have minimum npm version required by sailsjs. Still the application doesn't start. Has anybody attempted deploy sails v0.11 app on openshift before?
Thank you
I see below in the logs
DEBUG: Running node-supervisor with
DEBUG: program 'server.js'
DEBUG: --watch '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch'
DEBUG: --ignore 'undefined'
DEBUG: --extensions 'node|js|coffee'
DEBUG: --exec 'node'
DEBUG: Starting child process with 'node server.js'
DEBUG: Watching directory '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch' for changes.
Listening on 127.2.103.1, port 8080
DEBUG: Sending SIGTERM to child...
My solution as explained here works.
https://github.com/aug70/openshift-sails-starter
If you follow the instructions to setup a OpenShift cartridge and merge with this repo, you can deploy it on OpenShift.
Couple important points;
OpenShift package.json file is different!
You would want to use forever when running application and your start script should be something like
"start": "./node_modules/forever/bin/forever -l ~/app-root/logs/forever.log --append --pidFile ~/app-root/logs/forever.pid start app.js --prod"
If you happen to use mongodb, your connections.js file mongodb entry would be
"url : process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_GEAR_NAME "
Solution is based on Sails.js version 0.11.0

Trying to use meteor up on digital ocean

I have a digital ocean droplet that I am trying to deploy the most basic of meteor apps to, but I am getting a failing response. Any idea why this is happening?
UPDATE: added entire output
Anderss-iMac:microscope-deploy anderskitson$ mup deploy
Meteor-UP : Production Quality Meteor Deployments
--------------------------------------------------
Bundling Started: /Users/anderskitson/sites/microscope
Started TaskList: Deploying App
[bray.anderskitson.ca] uploading bundle
[bray.anderskitson.ca] uploading bundle: SUCCESS
[bray.anderskitson.ca] setting up env vars
[bray.anderskitson.ca] setting up env vars: SUCCESS
[bray.anderskitson.ca] invoking deployment process
[bray.anderskitson.ca] invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
Warning: Permanently added 'bray.anderskitson.ca,162.243.52.235' (RSA) to the list of known hosts.
npm WARN package.json http-proxy#1.0.0 No repository field.
npm http GET https://registry.npmjs.org/fibers
npm http 304 https://registry.npmjs.org/fibers
stop: Unknown instance:
bash: line 46: wait-for-mongo: command not found
-----------------------------------STDOUT-----------------------------------
> fibers#1.0.1 install /opt/meteor/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
fibers#1.0.1 node_modules/fibers
meteor start/running, process 10373
wait for mongo(5 minutes) to initiaze
----------------------------------------------------------------------------
Completed TaskList: Deploying App
I ran into same problem and I figured out that this command wasn't fired really well
sudo npm install -g forever userdown wait-for-mongo
and I manually did that so I can see wait-for-mongo a valid command,
see if that helps you too.

Categories

Resources