There exist acyclic infinite-dimensional Lie algebras, i.e., for which the trivial homology vanishes in all nonzero degree (recall that $H_0$ of every Lie algebra is always 1-dimensional over the ground field $K$).
Lemma. Let $\mathfrak{g}$ be the increasing union of Lie subalgebras $\mathfrak{g}_n$. Suppose that for fixed $k$, we have $H_k(\mathfrak{g}_n)=0$ for all $n$ large enough (say $n\ge N$). Then $H_k(\mathfrak{g})=0$.
Proof: this is essentially formal "diagram chasing". If $b\in Z_k(\mathfrak{g})\subset\bigwedge^k\mathfrak{g}$ (spaces of $k$-cycles and $k$-chains), there exists $n$, which we can choose $\ge N$, such that $b\in \bigwedge^k\mathfrak{g}_n$. Then $d_k(b)=0$, so $b\in Z_k(\mathfrak{g}_n)$. Since $H_k(\mathfrak{g}_n)=0$, there exists $c\in\Lambda^{k-1}\mathfrak{g}_n$ such that $d_{k-1}(c)=b$. Hence $b\in B_k(\mathfrak{g})$ (space of $k$-boundaries). This proves the lemma.
Corollary. Under the same assumptions, if for some sequence $(N_k)$, we have $H_k(\mathfrak{g}_n)=0$ for all $n\ge N_k$ and all $k\ge 1$, then $H_k(\mathfrak{g})=0$ for all $k$. $\Box$
So it is enough to have such an "increasing sequence of Lie algebras" $(\mathfrak{g}_n)$ at disposal. We can't choose them finite-dimensional (since $H_1$ and $H_3$ can't be both zero then, at least in char. zero). However there are examples in the literature:
For instance choose $\mathfrak{g}_n$ as the Lie algebra of formal power series vector fields $$\sum_{i=1}^nf_i\frac{\partial}{\partial x_i},\quad f_i\in K[\![x_1,\dots,x_n]\!].$$
Gelfand and Fuks proved in [1] (see [2], Corollary 1) that $H_k(\mathfrak{g}_n)=0$ for all $1\le k\le n$.
References:
[1] I. M. Gel′fand and D. B. Fuks, Cohomologies of the Lie algebra of formal vector fields, Izv. Akad. Nauk SSSR Ser. Mat. 34 (1970), 322–337 (Russian). MR 0266195
[2] Victor Guillemin and Steven Shnider, Some stable results on the cohomology of the classical infinite-dimensional Lie algebras, Trans. Amer. Math. Soc. 179 (1973), 275-280.
Link at AMS site, unrestricted access