Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

297
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda