I mentioned exactly this script in my previous post :)
It seems, updating Node to the latest version (v12.18.2) helped to solve the problem. But I am not sure as I tried different things in different combinations.
In any case, the problem has been solved.