Home > database >  'window.Vue.use is not a function' error on a Vue2 project
'window.Vue.use is not a function' error on a Vue2 project

Time:02-09

I have an application running in the Azure web app, it was working well and today the website is down suddenly with an error:

window.Vue.use is not a function

The App uses Vuetify as the frontend.

Does anyone know why? Is there a quick fix?

CodePudding user response:

Vue.use is from Vue 2's API, and that's now only available via an application instance in Vue 3. The error suggests your app is written with Vue 2's API, while Vue 3 is actually loaded. The timing of the error coincides with the yesterday's update to the vue package in NPM.

As of 7-FEB-2022, version 3 is the default in NPM (i.e., 3.2.30 is now the latest version), replacing Vue 2. Your app is likely pulling in vue from a CDN, and the URL is missing a version specifier (or you're using @latest):

<script src="https://unpkg.com/vue"></script> ⛔️ defaults to latest
<script src="https://unpkg.com/vue@latest"></script> ⛔️ no longer Vue 2

To ensure you're using Vue 2, include the @2 (or @2.6.14) version specifier in the URL:

<script src="https://unpkg.com/vue@2"></script>
                                              
  •  Tags:  
  • Related