Fix build on gentoo system

I couldn't build this on my system because `ls` was returning color
codes and the /$/ regex was failing to match end of line. Fixed this by
making the regex aware of colors.

Additionally `which` was spewing errors causing node-gyp to fail early.