A note on generalization of the Lewis invariant and the Ermakov systems