With the help of another User on Github we found out what was causing the error!
It was the sudo, that I mistakenly used to execute the script. Running the install as pi was the solution.
Hope this will help someone with the same problem. 🙂