analyze: Fix `dep` leak and remove `fs.exists` usage

This patch fixes a leaked global variable `dep` and removes the usage
of `fs.exists()`.  `fs.exists` is considered an anti-pattern (see
http://nodejs.org/api/fs.html#fs_fs_exists_path_callback), and can
easily be avoided by checking `err.code`.