The Zohar tells us that Joshua served Moses but he wasn’t great enough to replace him. God told Moses that after his death, the people will lose the path.
“וַיֹּאמֶר יְהוָה אֶל-מֹשֶׁה, הִנְּךָ שֹׁכֵב עִם-אֲבֹתֶיךָ; וְקָם הָעָם הַזֶּה וְזָנָה אַחֲרֵי אֱלֹהֵי נֵכַר-הָאָרֶץ, אֲשֶׁר הוּא בָא-שָׁמָּה בְּקִרְבּוֹ, וַעֲזָבַנִי, וְהֵפֵר אֶת-בְּרִיתִי אֲשֶׁר כָּרַתִּי אִתּוֹ”
“YHVH said to Moses, “Behold, you are about to lie down with your fathers; and this people will arise and play the harlot with the strange gods of the land, into the midst of which they are going, and will forsake Me and break My covenant which I have made with them.”
God revealed to Moses what would happen after the people disconnect from him.
“וְחָרָה אַפִּי בוֹ בַיּוֹם-הַהוּא וַעֲזַבְתִּים וְהִסְתַּרְתִּי פָנַי מֵהֶם, וְהָיָה לֶאֱכֹל, וּמְצָאֻהוּ רָעוֹת רַבּוֹת, וְצָרוֹת; וְאָמַר, בַּיּוֹם הַהוּא, הֲלֹא עַל כִּי-אֵין אֱלֹהַי בְּקִרְבִּי, מְצָאוּנִי הָרָעוֹת הָאֵלֶּה.”
“Then My anger will be kindled against them in that day, and I will forsake them and hide My face from them, and they will be consumed, and many evils and troubles will come upon them; so that they will say in that day, ‘Is it not because our God is not among us that these evils have come upon us?’”
After Moses’s death God told Joshua the formula for success.
“רַק חֲזַק וֶאֱמַץ מְאֹד, לִשְׁמֹר לַעֲשׂוֹת כְּכָל-הַתּוֹרָה–אֲשֶׁר צִוְּךָ מֹשֶׁה עַבְדִּי, אַל-תָּסוּר מִמֶּנּוּ יָמִין וּשְׂמֹאול: לְמַעַן תַּשְׂכִּיל, בְּכֹל אֲשֶׁר תֵּלֵךְ”
“”Only be strong and very courageous; be careful to do according to all the Torah which Moses My servant commanded you; do not turn from it to the right or to the left, so that you may have success wherever you go.”
The only way to stay above the chaos is to stay close to the Torah and follow it strictly.
“לֹא-יָמוּשׁ סֵפֶר הַתּוֹרָה הַזֶּה מִפִּיךָ, וְהָגִיתָ בּוֹ יוֹמָם וָלַיְלָה, לְמַעַן תִּשְׁמֹר לַעֲשׂוֹת, כְּכָל-הַכָּתוּב בּוֹ: כִּי-אָז תַּצְלִיחַ אֶת-דְּרָכֶךָ, וְאָז תַּשְׂכִּיל””This Book of the Torah shall not depart from your mouth, but you shall meditate on it day and night, so that you may be careful to do according to all that is written in it. For then you will make your way prosperous, and then you will have good success.”