Your code does not generate the animation because it works with plt=Plots.plot(), but in your case plt=gplot() is of type Context.
To get it work you should install three (small) packages, Compose.jl, Cairo.jl and Fontconfig.jl, all three being necessary to transform each graph plot into a png file, with the function Compose.PNG:
using Graphs
using GraphPlot, Compose, Cairo, Fontconfig
using Random, Plots
let
G = Graph(5);
edges =[(1,2), (2, 3), (1, 3), (1, 4), (4, 5), (1, 5)]
for e in edges
add_edge!(G, e)
end
X = [1.0,0.0,0.0,2.0,2.0]
Y = [0.5,0.0,1.0,0.0,1.0]
cmap = range(HSL(colorant"blue"), stop=HSL(colorant"yellow"), length=360)
colorlist = rand(100) * 360
fname=String[]
anim=Animation()
for i=1:30
color = cmap[Int(round(colorlist[i]))]
edgecolor=["#389826","#CB3C33","#9558B4","#2458B2","#9558B2", color]
plt= gplot(G, X,Y, nodelabel=1:5, NODESIZE=0.05, EDGELINEWIDTH=2,
nodefillc=colorant"grey", edgestrokec=edgecolor)
filename = joinpath(anim.dir, lpad(i, 6, "0")*".png")
push!(fname, filename)
draw(PNG(filename), plt)
end
anim = Animation(anim.dir, fname);
Plots.buildanimation(anim, "anim-graph.gif", fps = 12, show_msg=false)
end