This is what God told Israel before they crossed the Jordan into the land of Canaan.
He wanted them to stay true to Him and be His holy nation. They started out OK, but they didn't follow the command to teach God's law to their children, and so, generation after generation had to learn the hard way. Are we teaching our children? Are we worshiping other gods?
Deuteronomy 11:
16 Be careful, or you will be enticed to turn away and worship other gods and bow down to them. 17 Then the LORD's anger will burn against you, and he will shut the heavens so that it will not rain and the ground will yield no produce, and you will soon perish from the good land the LORD is giving you. 18 Fix these words of mine in your hearts and minds; tie them as symbols on your hands and bind them on your foreheads. 19 Teach them to your children, talking about them when you sit at home and when you walk along the road, when you lie down and when you get up. 20 Write them on the doorframes of your houses and on your gates, 21 so that your days and the days of your children may be many in the land that the LORD swore to give your forefathers, as many as the days that the heavens are above the earth.