Home > database >  404 Cannot find "/dist/vue-router.js" in [email protected]
404 Cannot find "/dist/vue-router.js" in [email protected]

Time:05-30

I have several script tag vue.js projects, all using CDN scripts, and all working fine until recently now all of a sudden all are getting a 404 error for https://unpkg.com/[email protected]/dist/vue-router.js, so I figured I could just find a copy of that script and replace but seems this is not the way as I have tried replacing it with several of the same from other CDNs with no joy, any help or pointers would be much appreciated.

Here is a codepen with the issue https://codepen.io/flashvenom/pen/RwZxddQ

Hit settings > JS, to access the script tags

Cheers

  template: '<div><div ></div>'
};

CodePudding user response:

Your project is using Vue 2, and the latest tags of vue, vuex, and vue-router were all updated to be specific to Vue 3.

Your Codepen's JS settings has these two external script URLs that default to the latest tags:

# vue-router@latest = 4.0.15 (not compatible with Vue 2, but CDN link is also broken apparently)
https://unpkg.com/vue-router/dist/vue-router.js

# vuex@latest = 4.0.2 (not compatible with Vue 2)
https://unpkg.com/vuex

Solution

Update those URLs to use versions that are compatible with Vue 2 (i.e., the 3.x versions of those libs in this case):

https://unpkg.com/vue-router@3
https://unpkg.com/vuex@3

updated codepen

  • Related