Wait for packages to install successfully before writing component.json -- Should solve #386