GET / - - - - ms in meanio - angularjs

I have installed the mean stack with the instructions below:
$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash
$ sudo apt-get update
$ sudo apt-get install nodejs
$ npm install -g gulp
$ npm install -g bower
$ sudo npm install -g mean-cli
$ mean init testApp
$ cd testApp && npm install
Whenever I run the gulp command it starts successfully and shows the last line:
Mean app started on port 3000 (development) cluster.worker.id: 0
[12:09:03] index.html reloaded.
After that if I go to localhost:3000 the page reloads in an infinite loop and shows the following output on the terminal:
Mean app started on port 3000 enter code here`(development) cluster.worker.id: 0
[12:09:03] index.html reloaded.
GET / - - - - ms
GET / - - - - ms
GET / - - - - ms

Cross check permissions on the npm also change owner from root.

Related

I got an illegal instruction when installing mongoDB when trying to check the version

Hey so I tried installing mongoDB and I can't get it to install correctly. I am installing it on wsl on a windows computer and I keep getting illegal instruction when I try to check the version and it won't let me finish installing it. Here are the instructions I used to install MongoDB (version 5.0) on WSL (Ubuntu 20.04):
Open your WSL terminal (ie. Ubuntu) and go to your home directory: cd ~
Update your Ubuntu packages: sudo apt update
Import the public key used by the MongoDB package management system: wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
Create a list file for MongoDB: echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
Reload local package database: sudo apt-get update
Install MongoDB packages: sudo apt-get install -y mongodb-org
Confirm installation and get the version number: mongod --version
Make a directory to store data: mkdir -p ~/data/db
Run a Mongo instance: sudo mongod --dbpath ~/data/db
Check to see that your MongoDB instance is running with: ps -e | grep 'mongod'
To exit the MongoDB Shell, use the shortcut keys: Ctrl + C

Installing Dropbox on Ubuntu 18 Server Failing

I am following this article to install and tried both methods.
Downloading the headless and the .deb methods I run the following commands:
$ ./dropboxd
And the DEB:
$ sudo dpkg -i dropbox_2020.03.04.deb
$ sudo apt -f install
$ dropbox start
For both I'm getting the error:
ImportError: libglapi.so.0:
I'm new to Linux server and I'm a little bit lost. Should I upgrade my server to Ubuntu 20?

Reusable docker image for AngularJS

We have an AngularJS application. We wrote a dockerfile for it so it's reusable on every system. The dockerfile isn't a best practice and it's maybe some weird build up (build and hosting in same file) for some but it's just created to run our angularjs app locally on each PC of every developer.
Dockerfile:
FROM nginx:1.10
... Steps to install nodejs-legacy + npm
RUN npm install -g gulp
RUN npm install
RUN gulp build
.. steps to move dist folder
We build our image with docker build -t myapp:latest .
Every developer is able to run our app with docker run -d -p 80:80 myapp:latest
But now we're developing other backends. So we have a backend in DEV, a backend in UAT, ...
So there are different URLS which we need to use in /config/xx.json
{
...
"service_base": "https://backend.test.xxx/",
...
}
We don't want to change that URL every time, rebuild the image and start it. We also don't want to declare some URLS (dev, uat, prod, ..) which can be used there. We want to perform our gulp build process with an environment variable instead of a hardcoded URL.
So we we can start our container like this:
docker run -d -p 80:80 --env URL=https://mybackendurl.com app:latest
Is there someone who has experience with this kind of issues? So we'll need an env variable in our json and building it and add the URL later on if that's possible.
EDIT : Better option is to use build args
Instead of passing URL at docker run command, you can use docker build args. It is better to have build related commands to be executed during docker build than docker run.
In your Dockerfile,
ARG URL
And then run
docker build --build-arg URL=<my-url> .
See this stackoverflow question for details
This was my 'solution'. I know it isn't the best docker approach but just for our developers it was a big help.
My dockerfile looks like this:
FROM nginx:1.10
RUN apt-get update && \
apt-get install -y curl
RUN sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's#<http://\(.*\)/debian/>;#\1#g'`/" /etc/apt/sources.list
RUN \
apt-get clean && \
apt-get update && \
apt-get install -y nodejs-legacy && \
apt-get install -y npm
WORKDIR /home/app
COPY . /home/app
RUN npm install -g gulp
RUN npm install
COPY start.sh /
CMD ["./start.sh"]
So after the whole include of the app + npm installation inside my nginx I start my container with the start.sh script.
The content of start.sh:
#!/bin/bash
sed -i 's#my-url#'"$DATA_ACCESS_URL"'#' configs/config.json
gulp build
rm -r /usr/share/nginx/html/
//cp right folders which are created by gulp build to /usr/share/nginx/html
...
//start nginx container
/usr/sbin/nginx -g "daemon off;"
So the build will happen when my container starts. Not the best way of course but it's all for the needs of the developers. Have an easy local frontend.
The sed command will perform a replace on the config file which contains something like:
{
"service_base": "my-url",
}
So my-url will be replaced by my the content of my environment variable which I willd define in my docker run command.
Than I'm able to perform.
docker run -d -p 80:80 -e DATA_ACCESS_URL=https://mybackendurl.com app:latest
And every developer can use the frontend locally and connect with their own backend URL.

How to make Protractor work while using Cloud9?

I am new to Cloud9 and I am trying to use Protractor for e2e testing. I am running the angular-phonecat examples.
The error is the folowing:
Using ChromeDriver directly...
/home/ubuntu/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109
var template = new Error(this.message);
^
UnknownError: chrome not reachable
(Driver info: chromedriver=2.10.267518,platform=Linux 3.14.13-c9 x86_64)
at new bot.Error (/home/ubuntu/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
..
I installed the chromedriver. The only thing is how to install the actual Chrome on cloud9 and run the tests?
Thank you in advance,
cheers,
Haytham
I'm a fan of webase IDE and Cloud9 is one of the best. Here a way to install Xvfb, chrome and Protractor for doing AngularJS end-to-end automated testing on Cloud9
Open a terminal (xvfb already installed on c9.io)
install X11 fonts
$ sudo apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
install last chrome
$ wget -q -O - \
https://dl-ssl.google.com/linux/linux_signing_key.pub \
| sudo apt-key add -
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" \
>> /etc/apt/sources.list.d/google-chrome.list'
$ sudo apt-get update
$ sudo apt-get install -y google-chrome-stable
install protractor
$ npm install -g protractor
update webdriver
$ webdriver-manager update
use --no-sandbox option with chrome
As c9.io is running inside container this option is needed.
Update protractor conf.js to pass the option to chrome
capabilities: {
browserName: 'chrome',
'chromeOptions': {
args: ['--no-sandbox']
}
}
run protractor test on headless chrome
start webdriver with xvfb (headless)
$ xvfb-run webdriver-manager start
run the test on other terminal
$ protrator conf.js
From http://blog.maduma.com
Its not possible to 'install' browsers onto cloud9 to run browser-based end-to-end test scenarios. The selenium web driver is looking to load chrome on which to run the tests but is throwing an error as it isn't something which can be found on the cloud9 development environment.
If you are committed to running these tests on an online IDE like cloud9 your only option is to use a headless browser like phantomJS but a note of caution from protractor docs
We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers.
I would recommend downloading your app locally and running extensive E2E tests across the browsers which your users will actually be using to access your app.
Another option is to use something like Saucelabs (https://saucelabs.com/) for automated cloud-based cross-browser testing; this will need some configuration in the protractor_conf.js file. Note that there may be additional costs involved with cloud-based testing.
I just tested this and it is working for me on my chromebook. It contains all of the steps necessary to complete the first page of https://docs.angularjs.org/tutorial, including setting up the protractor tests.
create new blank workspace
run these commands
rm -rf * .c9
git clone --depth=16 https://github.com/angular/angular-phonecat.git
cd angular-phonecat
nvm install 7
nvm alias default node
npm install minimatch
sudo npm install npm -g
edit this file
angular-phonecat/package.json
"start": "http-server ./app -a $IP -p $PORT -c-1"
run these commands
npm start
click 'Share'
browse to url next to 'Application'
yay! the phonecat webapp should be running!
karma
add these lines to karma.conf.js
hostname: process.env.IP,
port: process.env.PORT
edit package.json
"test": "karma start karma.conf.js --no-browsers"
run this command
npm test
browse to http://<projectName>.<cloud9User>.c9.io:8081
go forth and test!
protractor
run these commands
sudo apt-get update
sudo apt-get install -y xvfb
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install -y google-chrome-stable
edit protractor.conf.js
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
args: ['--no-sandbox']
}
}
run these commands
npm install -g protractor
sudo webdriver-manager update
xvfb-run webdriver-manager start
edit protractor.conf.js
baseUrl: 'http://' + process.env.IP + ':' + process.env.PORT + '/'
seleniumAddress: 'http://127.0.0.1:4444/wd/hub'
run these commands
protractor protractor.conf.js

AngularDart build with Docker

I try to deploy my angular-dart app with docker but can't get it to work.
Everything works on OS X but fails inside the container.
my pubspec.yaml:
name: myapp
dependencies:
browser: any
angular: 1.0.0
transformers:
- angular
my Dockerfile:
FROM stackbrew/ubuntu:13.10
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y apt-transport-https curl git
RUN sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
RUN sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
RUN apt-get update
RUN apt-get install dart/stable
env PATH $PATH:/usr/lib/dart/bin
ADD frontend/pubspec.yaml /container/pubspec.yaml
ADD frontend/web /container/web
WORKDIR /container
RUN pub build
Dart gets installed as expected (Dart VM version: 1.7.2)
But it fails at pub build with:
Error on line 6, column 5 of pubspec.yaml: Error loading transformer: Illegal argument(s): sdkDirectory must be provided.
- angular
^^^^^^^
I found this https://github.com/angular/angular.dart/issues/1270 which suggests to add the dartSDK path to pubspec.yaml. Which can't be the solution.
The app should be runnable on every machine.. not only on those where the dartSdk path matches with the hardcoded path in pubspec.yaml
Is there another way to fix this? or a workaround?
Update
Should be fixed in code_transformers 0.2.3+2 (see http://dartbug.com/21225)
Old
I don't know yet why this is necessary on some systems and not on others but this should fix it.
transformers:
- angular:
sdkDirectory: "/usr/lib/dart"
See also https://github.com/angular/angular.dart/issues/1270#issuecomment-64967674 for an alternative approach using symlinks.

Resources