Deploy Phoenix/Elixir project issue: npm ERR! TypeError: Object.keys called on non-object

When you deploy you phoenix/elixir project on production and something goes wrong it is very useful to make a git clone of your project directly on production server and try to run it there via iex -S mix to see what’s wrong. This is actually no really good practice but one of the fastest options.

I also had something strange on my server and I cloned project there and when I run npm install to get all node packages for the brunch I realised that I’ve got wrong node version on prod:

As brunch work on node >= 4.0.0 we need to upgrade nodejs. I upgraded nodejs from v0.10.25 to v4.4.4 with this askubuntu post:

After this running iex -S mix phoenix.server was fine.