"only then can you do" vs "only then you can do" [duplicate]

Solution 1:

After only then in this context, inversion is pretty much obligatory.

Solution 2:

The phenomon that the normal order of sentence elements is changed is called inversion, subject-verb inversion. Inversion is found regulary if the first position of the sentence is occupied by an adverb with negative or restricting character. Such adverbs/adverb groups are: hardly, scarcely, never, no sooner, under no circumstances, in vain and similar expressions. In spoken language the regular order of sentence elements is perferred. "only then" is an adverb group with restricting character so in written style you will find inversion. But this does not mean the normal sentence order is impossible. And of course there are other types of inversion.