I'm trying to compute the expansion of $ (1-\frac{1}{x})^x $ at infinity, which is given by WolframAlpha as $$ \frac{1}{e} - \frac{1}{2ex} - \frac{5}{24ex^2} - \frac{5}{48ex^3} - \frac{337}{5760ex^4} + O(x^{-5}) $$
I tried substituting $ u = \frac{1}{x} $, but this doesn't help as the derivative of $(1-u)^{1/u} $ seems to be indeterminate at $ u = 0 $. What am I missing?