For example
\begin{equation} \begin{aligned} \lim_{n \to \infty} \left(1 + \frac{1}{ \frac{n-1}{2}} \right)^{n} &= \lim_{n \to \infty} \left(1 + \frac{1}{ \frac{n-1}{2}} \right)^{\frac{n-1}{2}\cdot\frac{2}{n-1}\cdot n} \\ &= \lim_{n \to \infty} \left(\lim_{n \to \infty} \left(1 + \frac{1}{ \frac{n-1}{2}} \right)^{\frac{n-1}{2}} \right)^{\frac{2}{n-1}\cdot n} \\&= \lim_{n \to \infty} e^{\frac{2n}{n-1}} = e^{2} \end{aligned} \end{equation}
In general we can not move the limit under a non constant exponent and evaluate the exponent limit later
$$ e = \lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)^n \neq \lim_{n \to \infty} \left( \lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)\right)^n = 1 $$
What am I missing here?
It is not taking the limit "outside," really, but pushing it inside. So: $$\lim_{n\to\infty} f(n)^{g(n)} = (\lim f(n))^{\lim g(n)}$$
When both $\lim f(n)$ and $\lim g(n)$ exist.
This is true because (for some values $x,y$ at least) the function $(x,y)\to x^y$ is a continuous function. (Specifically, it is continuous at $(x,y)$ when $x>0$.