fix requires not exits and fix writeFileSync bug