Dong3000
Dong3000

Reputation: 596

Sudden VueJS error: ERROR in multi vue, module not found: Error: Can't resolve 'vue' in

Every day, I come to my office, launch my IDE (Code - OSS) and run npm run watch. Every day it works like a charm. But not today. Oddly enough, today running npm run watch fires this error:

ERROR in multi vue Module not found: Error: Can't resolve 'vue' in '/home/TopSecretUser/Code/Local/TopSecretProject/11.11.2020/dev' @ multi vue /js/vendor[0]

ERROR in ./resources/js/app.js Module not found: Error: Can't resolve 'vue' in '/home/me/Code/Local/TopSecretProject/11.11.2020/dev/resources/js' @ ./resources/js/app.js 3:13-16 4:0-22 6:0-3 85:14-17 @ multi ./resources/js/app.js ./resources/css/app.css

My app.js starts with the following lines:

require("./bootstrap");

import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

...

I haven't made any changes from yesterday to today, so I am totally confused. I tried some fixings but nothing worked. Does anyone have any suggestion how i can fix this? I am using [email protected].

Upvotes: 2

Views: 3875

Answers (2)

Mahdi Abedi
Mahdi Abedi

Reputation: 146

after a while I found the solution , just import component as this:

Vue.component('Date',required('components/Date.vue'));

Upvotes: 0

Boussadjra Brahim
Boussadjra Brahim

Reputation: 1

You could delete the node_modules which could be affected by an external action like deletion/moving or you mis-installed a module, then rerun :

npm install

this will fetch the dependencies in package.json and install them, you should always install a module by adding --save or --save-dev flag with npm i like npm i some-module --save

Upvotes: 1

Related Questions