Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
vue-session: Uncaught TypeError: Cannot set properties of undefined (setting '$session')

I just install vue-session plugin to my project(vue 3 with Vite), with the setup like below:

import { createApp } from 'vue'
import App from './App.vue'
import VueSession from 'vue-session'  <---
import router from './router.js' // 

createApp(App).use(router).use(VueSession).mount('#app')

But when I tried to reload the page, it shows:

Uncaught TypeError: Cannot set properties of undefined (setting '$session')
at Object.VueSession.install (index.js:13:19)
at Object.use (runtime-core.esm-bundler.js:3808:28)
at main.js?t=1648710456054:7:28

The other plugin also show same error:

Uncaught TypeError: Cannot set properties of undefined (setting '$cookies')
at Object.install (vue-cookies.js:22:21)
at Object.use (runtime-core.esm-bundler.js:3808:28)
at main.js?t=1648712611253:7:28

Source: vue-session

Vue.prototype.$session = {   <--this line
    flash: {
        parent: function(){
            return Vue.prototype.$session;
        },
        get: function(key){
    ....

vue-cookies

var VueCookies = {
// install of Vue
install: function (Vue) {
  Vue.prototype.$cookies = this;
  Vue.$cookies = this;
},

Can somebody help a JS newbie?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It s a Vue2 plugin. It wont works with Vue3.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda