Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
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 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!