Why does the function "gif" take forever to run?

I’m trying to use “@animate” and “gif” in Plots.jl to generate .gif file. The macro @animate can be operated successfully, while the function “gif” cannot stop running and no gif file is generated. I have installed FFmpeg in my device. Has anyone come up with the same issue? Or does anybody happen to know how to solve the issue?Thank you very much!