refactor lib/install.js