You need to enable script editing in this modern site,
The command for your reference:
Connect-SPOService -Url https://contoso-admin.sharepoint.com Set-Sposite -Identity modernsiteUrl -DenyAddAndCustomizePages 0
Here is a video on how to install modern script editor in modern site for your reference:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I reproduced your problem before executing these two cmdlets, the problem was solved after execution, you could have a try.
The video I shared with you has the complete installation process of modern script editor, you can use it as a reference.
Hi @john john ,
I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.
You can accept the helpful post as answer to help other community members find helpful information quickly.
You can also share your own solution here and mark it as answer, and we can learn from each other.