clemon ezeh
clemon ezeh

Reputation: 73

Issues installing element ui plugin in vue3 project

Hello guys please am having issues installing plugins on Vue js, so I tried installing Element Ui plugins on my project the installation was successful but in my Vs Code terminal it's bringing out this:

Compiled with 1 warning
warning in ./src/plugins/element.js "export 'default' (imported as 'Vue') was not found in 'vue'

And I can't access my project on the localhost server it's just blank.

My Main.JS File

import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./plugins/element.js";

createApp(App)
  .use(store)
  .use(router)
  .mount("#app");

Package.Json

  "name": "jargonapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "element-ui": "^2.4.5",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0",
    "vue-cli-plugin-element": "~1.0.1"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

Upvotes: 3

Views: 2834

Answers (1)

Boussadjra Brahim
Boussadjra Brahim

Reputation: 1

It seems that you're using element ui 2 with vue 3 which are not compatible, to work with Vue 3 you have to install the element ui plus

uninstall the current version :

npm uninstall  element-ui -S

then install the latest one :

npm i element-plus -S

the main.js minimum content :

import { createApp } from "vue";
import router from "./router";
import store from "./store";

import ElementPlus from "element-plus";
import "element-plus/lib/theme-chalk/index.css";

import App from "./App.vue";

createApp(App)
.use(ElementPlus)
.use(store)
.use(router)
.mount("#app");

Upvotes: 3

Related Questions