Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to install v-select getting Vue is not defined

New to Vue, but trying to get v-select working. I’m getting vue is not defined when importing. Then when I import vue I’m getting a different error as listed below:

main.js

import { createApp } from 'vue'
import App from './App.vue'

import vSelect from 'vue-select'
Vue.component('v-select', vSelect)
import 'vue-select/dist/vue-select.css';


createApp(App).mount('#app')

Error

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

-- 'Vue' is not defined

When adding import Vue from 'vue'

Cannot read properties of undefined (reading 'component')

>Solution :

Assuming you’ve installed the right version of v-select that’s compatible with vue 3 you should use app.component(...) to register it not Vue.component(...) :

import { createApp } from 'vue'
import App from './App.vue'

import vSelect from 'vue-select'
import 'vue-select/dist/vue-select.css';

const app=createApp(App)
app.component('v-select', vSelect)
app.mount('#app')

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading