A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Hi @john john ,
I could reproduce this issue on a modern site, however it could run successfully on a classic site.
As said in the following article, “Add-PnPJavaScriptLink” is valid only for SharePoint classic site experience.
https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpjavascriptlink?view=sharepoint-ps
Since the site you applied the script to is a modern site, It cannot be successfully executed. You can have a try on a classic site.
I hope this information has been useful, please let me know if you still need assistance.
If an Answer 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.