Internal Server Error after making new app

I have a fresh ERPNext V12 installation (master-branch, --production).
It is a multi tenant setup and works as intended. Clean install, nothing added just yet, except the initial setup.

Now, I want to develop an app for one of the sites.
I set the developer mode to 1 for that site (since it is a production build) and run the command

bench new-app library_management (following the tutorial from frappe).

The app is created successfully. All files were created.

Then I ran bench --site site1.test install-app library_management.
The app was successfully installed.

However, the page does not work anymore. When I open site1.test, which should load the standard welcome page from ERPNext, now it gives me an Internal Server Error.

I also run bench --site site1.test migrate but it does not change anything.

When I remove the app again via bench --site site1.test uninstall-app library_management the page loads again as expected.

EDIT:
So, after stopping production and switching to development following this:

The app installation works.

Any hint to why this is?