educative.io

Cannot run the script

When I tried to run the last script in the page:

It did not work.

In the console, it prompted:

Uncaught TypeError: Vue is not a constructor at index.html?id=jJ9oL:4:1

I think it is due to the tutorial was for vue2 but the CDN has been changed to vue3 already.

Solution:

Change the line under the HTML tab:

<script src="https://cdn.jsdelivr.net/npm/vue"></script>

to:
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>

However, for the challenge part, as the tab HTML is not present. So a localhost webserver is used to host the vue2.js file, cdn.jsdelivr.net is changed to localhost in the hosts file and the SSL checking in chrome is bypassed. Then it works for the whole course.