To solve this error: Load your library at the beginning of all your scripts.
There can be multiple other reasons for this issue:
We suspect that the issue you are facing at your end is due to an improper script reference in the Site.master page. Also, using duplicate script references will cause unwanted behavior in the output of the sample. Please check the below KB document links to resolve the issue at your end.
Please let us know if you need any further assistance.