I am trying to update a project from vuetify 2 to vuetify 3, naturally, I’m updating vue 2 to vue 3.
I have managed all of the dependencies problems, but I am not sure if I updated all the config files of the projects the good way (I mean the main.js, the vuetify.js etc.), so when I do npm i
, I have no problem of dependencies, everything is installed.
But when I hit npm run dev
, this error pops up :
ERROR TypeError: Cannot read properties of undefined (reading 'vuetify')
TypeError: Cannot read properties of undefined (reading 'vuetify')
at privatenode_modulesvue-cli-plugin-vuetifyindex.js:29:54
at privatenode_modules@vuecli-servicelibService.js:268:40
at Array.forEach (<anonymous>)
at Service.resolveChainableWebpackConfig (privatenode_modules@vuecli-servicelibService.js:268:26)
at Service.resolveWebpackConfig (privatenode_modules@vuecli-servicelibService.js:272:48)
at PluginAPI.resolveWebpackConfig (privatenode_modules@vuecli-servicelibPluginAPI.js:132:25)
at serve (private@vuecli-servicelibcommandsserve.js:79:31)
at Service.run (privatenode_modules@vuecli-servicelibService.js:262:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Here is the content of the node_modulesvue-cli-plugin-vuetifyindex.js at the line 29 :
22 if (isVue3) {
23 if (hasVuetifyPlugin) {
24 const { VuetifyPlugin } = require('webpack-plugin-vuetify')
25
26 api.chainWebpack(config => {
27 config
28 .plugin('VuetifyPlugin')
29 .use(VuetifyPlugin, [options.pluginOptions.vuetify])
30 })
31 } else if (hasVuetifyLoader) {
32 throw new Error('vuetify-loader is only for use with vuetify 2, replace it with webpack-
33 plugin-vuetify')
34 }
35 } else if (hasVuetifyLoader) {
36 const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
37
38 api.chainWebpack(config => {
39 config
40 .plugin('VuetifyLoaderPlugin')
41 .use(VuetifyLoaderPlugin)
42 })
43 }
Here is my package.json (of course I have other needed informations in it but I chose to not display them) :
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:e2e": "vue-cli-service test:e2e",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"apexcharts": "^3.50.0",
"axios": "^1.7.2",
"core-js": "^3.37.1",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"numeral": "^2.0.6",
"v-offline": "^3.5.0",
"vue": "^3.4.31",
"vue-apexcharts": "^1.6.2",
"vue-lodash": "^2.1.2",
"vue-meta": "^2.4.0",
"vue-numerals": "^4.0.6",
"vue-router": "^4.4.0",
"vuelidate": "^0.7.7",
"vuetify": "^3.6.11",
"vuex": "^4.1.0",
"vuex-router-sync": "^6.0.0-rc.1",
"webpack-plugin-vuetify": "^3.0.3"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/plugin-transform-spread": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/runtime": "^7.24.7",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-e2e-cypress": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-plugin-unit-jest": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "^2.4.6",
"babel-eslint": "^10.1.0",
"babel-jest": "^29.7.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"eslint": "^9.6.0",
"eslint-config-vuetify": "^1.0.0",
"eslint-plugin-lodash": "^8.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "^9.27.0",
"node-sass": "^9.0.0",
"prettier": "^3.3.2",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"stylus": "^0.63.0",
"stylus-loader": "^8.1.0",
"vue-cli-plugin-eslint-config-vuetify": "^0.0.3",
"vue-cli-plugin-vuetify": "^2.5.8",
"vue-cli-plugin-vuetify-essentials": "^0.8.3",
"vue-template-compiler": "^2.7.16"
}
Here is my main.js :
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./plugins";
import vuetify from "./plugins/vuetify";
import { sync } from "vuex-router-sync";
import VueLodash from "vue-lodash";
import lodash from "lodash";
import Vuelidate from "vuelidate";
Vue.use(Vuelidate);
Vue.use(VueLodash, { name: "lo", lodash: lodash });
sync(store, router);
Vue.config.productionTip = false;
new Vue({
router,
store,
vuetify,
render: h => h(App)
}).$mount("#app");
And the plugins/vuetify.js :
import Vue from "vue";
import Vuetify from "vuetify/lib";
Vue.use(Vuetify);
export default new Vuetify({
theme: {
themes: {
light: {
primary: "#0055A4",
secondary: "#1480CF",
tertiary: "#495057",
accent: "#eb4952",
error: "#f55a4e",
info: "#0E264A",
success: "#5cb860",
warning: "#ffa21a",
new_blue: "#009DCC",
new_orange: "#EA5B0F",
black_text: "#001737",
background: "#f3f3f3",
filter_btn: "#cdd6dc",
subtitle: "#495463",
user_square: "#1763aa"
}
}
},
icons: {
iconfont: "mdi"
}
});
Can someone help me to understand the problem ?
Thanks in advance for anyone helping
user26243472 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.