Thursday, December 31, 2015

ReferenceError: Promise is not defined on gulp build

While going thru getting started guide of polymer starter kit, I run into following issue -

> gulp
[15:12:04] Using gulpfile ~/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/gulpfile.js
[15:12:04] Starting 'clean'...
[15:12:04] Finished 'clean' after 18 ms
[15:12:04] Starting 'default'...
[15:12:04] Starting 'copy'...
[15:12:04] Starting 'styles'...

/Users/UserName/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:157
        this.processing = new Promise(function (resolve, reject) {
                              ^
ReferenceError: Promise is not defined

    at LazyResult.async (/Users/UserName/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:157:31)

The issue is my node version, it needs to be 0.12.5 (it was 0.10.3)

Here are the steps to upgrade -
$ sudo npm cache clean -f
$ sudo npm install -g n
$ node -v
v0.10.35

It still says 0.10.35

Here is the way to switch between versions -

$ sudo n stable
$ node -v
v5.2.0

means Now we can move to 0.12.5 in easy steps -
$ sudo n 0.12.5
$ node -v
0.12.5

Now running gulp build works fine!

Monday, December 28, 2015

pip freeze - unknown revision or path not in the working tre

While trying to get the list of the current package using pip freeze, it throws following error -

> pip freeze
Complete output from command /usr/bin/git rev-parse (detachedfrom0af02a9):
fatal: ambiguous argument '(detachedfrom0af02a9)': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git [...] -- [...]'

(detachedfrom0af02a9)

----------------------------------------
Command /usr/bin/git rev-parse (detachedfrom0af02a9) failed with error code 128

Storing complete log in /home/youraccount/.pip/pip.log

It's issue with the outdated pip package. To fix the issue -

You can upgrade it with following command -

pip install --upgrade pip

It should fix the issue.

Sunday, December 13, 2015

GO and bee

Get started with Go and Bee framework

brew install go

set following in .bash_profile

export PATH=$PATH:/usr/local/opt/go/libexec/bin
export GOPATH=/Users//goapp

(Instead of username, use path to your home directory)
With this you can access go on command prompt, and when you install bee packages it automatically go to go path you have set.

$ go get github.com/astaxie/beego
$ go get github.com/beego/bee

Install sample file to verify its working

$ cd $GOPATH/src
$ bee new hello
$ cd hello
$ bee run

In case you want to run the application on different port, open app.conf and update the parameters. It's self-explanatory.

You will be able to see the welcome screen.

Monday, December 7, 2015

Sentry Installation in local

Sentry is error logging, aggregation and tracking package. (for both server side, and client side)

mkvirtualenv sentry
workon sentry
pip install sentry --upgrade

sentry init
It will ask for creating conf file in your parent user dir. e.g. /Users//.sentry/sentry.conf.py
vi /home//.sentry/sentry.conf.py > you can review the file

Set SENTRY_ADMIN_EMAIL and SENTRY_URL_PREFIX

SENTRY_ADMIN_EMAIL : ‘your@email.com
SENTRY_URL_PREFIX: ‘http://127.0.0.1:9000

easy_install -UZ sentry[postgres]
Creates postgres db for sentry

sentry --config=/home//.sentry/sentry.conf.py upgrade

you may run into issue with redis connectivity - 127.0.0.1:6379. Connection refused

Check if redis is running -
$ redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>

That means redis is not running, open another terminal and run following command -
$ redis-server

Now if you run the previous command again -
$ redis-cli
redis 127.0.0.1:6379>

Now try to run the upgrade command -

It fails with following error -
Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

the issue is with libxml2, I resolved using this stack overflow thread -

brew install libxml2
brew install libxslt
brew link libxml2 --force
brew link libxslt --force

It will create all required tables, default user (select it as super user)

Now start sentry -
sentry start

Go to http://127.0.0.1:9000/ to access the local sentry. Get configuration and setup in your project to see the errors get logged on this local sentry instance.

Happy logging!