N3
ないうちに
Before (something happens), While not yet
こうき君、しばらく会わないうちに、すごく大きくなったね!
Kouki, you've grown so much since I last saw you!
Explanation
「ないうちに」 has 2 uses
1Act before X happens
Do something on purpose before an unwanted change starts. The second half is an intention, advice or request: 「忘れないうちにメモする」 (I'll write it down before I forget).
暗くならないうちに帰って来なさいよ。
Come back home before it gets dark.
また電話をかけ忘れるところだった。忘れないうちに電話しておかなきゃ。
I was just about to forget to make a phone call again. I should call before I forget.
2Before one knows it
Before the first part has (hardly) happened, something unexpected has already happened. The second half is a past result, often with 「〜てしまった」 or 「〜ていた」: 「知らないうちに店が閉まっていた」 (The shop had closed before I knew it).
こうき君、しばらく会わないうちに、すごく大きくなったね!
Kouki, you've grown so much since I last saw you!
私が知らないうちに、友達が離婚していた。
Before I knew it, my friend was divorced.
Mixed up with
「~まえに」 uses the dictionary form and only states the order: 「寝る前に」 (before sleeping).
「~ないうちに」 carries a worry that things get worse once the state changes: 「冷めないうちに」 (before it gets cold).
「ないうちに」 goes only after a negative verb; you can't say 'noun + のないうちに'.