\(\frac{2x}{x+1}=\frac{x^2-x+8}{\left(x+1\right)\left(x-4\right)}\)
\(\Rightarrow\frac{2x\left(x-4\right)}{\left(x+1\right)\left(x-4\right)}=\frac{x^2-x+8}{\left(x+1\right)\left(x-4\right)}\)
\(\Rightarrow2x\left(x-4\right)=x^2-x+8\)
\(\Leftrightarrow x^2-7x-8=0\)
\(\Leftrightarrow\left(x+1\right)\left(x-8\right)=0\)
\(\Rightarrow\left[{}\begin{matrix}x=-1\\x=8\end{matrix}\right.\)