Update checkTargetDir to support Node 8.1

In Node 8.1, path.existsSync was moved to fs.existsSync