5. Let the sequence $\left\{a_{n}\right\}$ satisfy
$$
\begin{array}{l}
\left(2-a_{n+1}\right)\left(4+a_{n}\right)=8(n \geqslant 1), \text { and } a_{1}=2 . \\
\text { Then } \frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{n}}=
\end{array}
$$
$\begin{array}{l}\text { 5. } 2^{n}-\frac{n}{2}-1 . \\ \text { From }\left(2-a_{n+1}\right)\left(4+a_{n}\right)=8 \\ \Rightarrow 2 a_{n}-4 a_{n+1}=a_{n} a_{n+1} \\ \Rightarrow \frac{2}{a_{n+1}}-\frac{4}{a_{n}}=1 \\ \Rightarrow \frac{2}{a_{n+1}}+1=2\left(\frac{2}{a_{n}}+1\right) . \\ \text { Then } \frac{2}{a_{n}}+1=\left(\frac{2}{a_{1}}+1\right) 2^{n-1}=2^{n} \\ \Rightarrow \frac{1}{a_{n}}=\frac{2^{n}-1}{2} . \\ \text { Therefore } \frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{n}}=2^{n}-\frac{n}{2}-1 .\end{array}$