We plan to enable Modern UI for users starting from 2026 R1. So I finished migration and testing on my local 2026 R1 instance, and I can publish the project normally here.
I know this is not a standard practice, but I just wanted to see how Modern UI works in a real environment. Therefore, I tried publishing this project to our online test environment(2025R2), which is a clone of our production environment (2025R2).
Strangely, the publication failed, and no additional error details were shown.

I tried a common workaround:
removed all Modern UI files and republished the project, and it succeeded. But after putting the Modern UI files back, the publication failed again.---This workaound does not work for me.
Then I ran NPM commands manually. Building a single screen, an entire module, or executing npm run build-dev -- --env customFolder=development all completed successfully. I could also see the updated Modern UI changes on the pages.---This is my workaournd
I have achieved my original goal of checking Modern UI performance in a real environment. However, I am curious about why the customization publish keeps failing. I want to find out the exact cause.