Book of Joshua

The book of Joshua contains the following verses:

About the City of Dan

When the territory of the Danites was lost to them, they went up and attacked Leshem, took it, put it to the sword and occupied it. They settled in Leshem and named it Dan after their ancestor. Joshua 19:47

But this incidence happened after his death

Then they took what Micah had made, and his priest, and went on to Laish, against a people at peace and secure. They attacked them with the sword and burned down their city. There was no one to rescue them because they lived a long way from Sidon and had no relationship with anyone else. The city was in a valley near Beth Rehob. The Danites rebuilt the city and settled there. They named it Dan after their ancestor Dan, who was born to Israel—though the city used to be called Laish. There the Danites set up for themselves the idol, and Jonathan son of Gershom, the son of Moses, and his sons were priests for the tribe of Dan until the time of the captivity of the land. They continued to use the idol Micah had made, all the time the house of God was in Shiloh. Judges 18:27-31

Joshua wrote about his death:

After these things, Joshua son of Nun, the servant of the Lord, died at the age of a hundred and ten. And they buried him in the land of his inheritance, at Timnath Serah in the hill country of Ephraim, north of Mount Gaash. Israel served the Lord throughout the lifetime of Joshua and of the elders who outlived him and who had experienced everything the Lord had done for Israel. Joshua 24:29-31.