syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
Angular2 Tour Of Heros Routing?
This page corresponds to a Meetup and a git-repo: This Meetup has two tracks:
  • Run Tour Of Heros demo on plnkr.co
  • Run Tour Of Heros demo on your laptop
The first track is the easy track.

It would be suitable, however, for the student who wants to focus on Angular2 syntax.

All you need for the first track is any laptop which can run a google-chrome-browser.

The code for the first track is at this URL:

https://github.com/danbikle/ang2tut20160227

The way I do the first track is to copy-paste syntax out of the above repo into a plnkr.co session.

We should have a short demo of me doing this in the lecture portion of the Meetup.

The second track will be more difficult because I cannot get Tour Of Heros to run on my laptop.

So if you want to wrestle with a somewhat typical-annoying-NodeJS bug, then track two is for you.

We start track two by assuming you have Ubuntu installed on your laptop.

If you want to try doing this class with MacOS/X instead of Ubuntu, that should be do-able.

I start by installing Ubuntu 14.04 on my laptop.

The most recent version of Ubuntu which I like is at this URL:

http://releases.ubuntu.com/14.04.3/ubuntu-14.04.3-desktop-amd64.iso

The three general paths to install Ubuntu on a laptop are listed below:
  • Remove Windows and install Ubuntu
  • Ignore Windows and install Ubuntu on USB drive
  • Install VirtualBox on Mac or Windows, Install Ubuntu inside VirtualBox
My favorite path is path2: Ignore Windows and install Ubuntu on USB drive.

Path2 works well with a new laptop should I want to maintain the warranty.

If you are new to the world of Ubuntu laptops I suggest you buy a cheap windows laptop from Walmart and run some experiments.

E-me if you need help: bikle101@gmail.com

So, after I installed Ubuntu on my laptop, I ran some shell commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev \
libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 sqlite3    \
libgdbm-dev libsqlite3-dev gitk emacs wget curl openssh-server aptitude
sudo apt-get update
sudo apt-get upgrade
Next, I downloaded and installed Node.js:
cd ~
rm -rf node node-v5.7.0-linux-x64.tar.xz
wget https://nodejs.org/dist/v5.7.0/node-v5.7.0-linux-x64.tar.xz
tar xf node-v5.7.0-linux-x64.tar.xz
mv     node-v5.7.0-linux-x64 node
Then I ran some shell commands:
cd ~
git clone https://github.com/danbikle/ang2tut20160227
cd ~/ang2tut20160227/hero_ed/qk_start
ls -l
npm set progress=false
npm install -s
At this point I should see an error message from npm:

dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ 
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ 
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ npm set progress=false
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ npm install -s
make: Entering directory `/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw { dev: 2049,
  mode: 33204,
  nlink: 1,
  uid: 1000,
  gid: 1000,
  rdev: 0,
  blksize: 4096,
  ino: 26746685,
  size: 1278,
  blocks: 8,
  atime: Sat Feb 27 2016 10:04:17 GMT+0000 (UTC),
  mtime: Sat Feb 27 2016 10:04:17 GMT+0000 (UTC),
  ctime: Sat Feb 27 2016 10:04:17 GMT+0000 (UTC),
  birthtime: Sat Feb 27 2016 10:04:17 GMT+0000 (UTC) }
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory `/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/bufferutil/build'
make: Entering directory `/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw { dev: 2049,
  mode: 33204,
  nlink: 1,
  uid: 1000,
  gid: 1000,
  rdev: 0,
  blksize: 4096,
  ino: 4856451,
  size: 1278,
  blocks: 8,
  atime: Sat Feb 27 2016 10:04:19 GMT+0000 (UTC),
  mtime: Sat Feb 27 2016 10:04:19 GMT+0000 (UTC),
  ctime: Sat Feb 27 2016 10:04:19 GMT+0000 (UTC),
  birthtime: Sat Feb 27 2016 10:04:19 GMT+0000 (UTC) }
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory `/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/utf-8-validate/build'
? May typings anonymously report usage statistics to improve the tool over time? (Y/n) 

/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/rx-lite/rx.lite.js:75
    throw e;
    ^

SyntaxError: Invalid regular expression: /.{1,0}/: numbers out of order in {} quantifier.
    at new RegExp (native)
    at breakLines (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/utils/screen-manager.js:108:15)
    at ScreenManager.render (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/utils/screen-manager.js:55:22)
    at Prompt.render (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/prompts/confirm.js:85:15)
    at Prompt._run (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/prompts/confirm.js:65:8)
    at Prompt.run (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/prompts/base.js:57:8)
    at Object.<anonymous> (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/ui/prompt.js:84:12)
    at module.exports (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/run-async/index.js:15:21)
    at AnonymousObservable.__subscribe (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/insight/node_modules/inquirer/lib/utils/utils.js:16:7)
    at AnonymousObservable.tryCatcher (/home/dan/ang2tut20160227/hero_ed/qk_start/node_modules/rx-lite/rx.lite.js:63:31)
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ 
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ 
dan@nia111:~/ang2tut20160227/hero_ed/qk_start $ 
The point of track two is either fix or work-around the above error message.

That should be enough to keep us busy for 2 hours.

E-me if you need help: bikle101@gmail.com


syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me