I think you only want to call `console.error()` if `fs.remove()` fails:

```
    fs.remove(installDirectory, function (err) {
        if (err) {
            console.error("Error while removing directory after failed installation", installDirectory, err);
        }
    });
```

Same comment for line 109.