Assume the initial data of compressible Euler equations has finite energy and total mass. We can construct a sequence of solutions of one-dimensional compressible Navier-Stokes equations (density-dependent viscosity) with stress-free boundary conditions, so that, up to a subsequence, the sequence of solutions of compressible Navier-Stokes equations converge to a finite-energy weak solution of compressible Euler equations. Hence the inviscid limit of the compressible Navier-Stokes is justified. It is worth pointing out that our result covers the interesting case of the Saint-Venant model for shallow water (i.e., $\alpha=1$, $\gamma=2$).