after I installed vue.js on my laravel project and running npm run dev
this error comes out.
When running "npm run dev" [webpack-cli] Error: Cannot find module 'vue/compiler-sfc' [Laravel with Vue.js]
Asked Answered
I was having the same problem, basically what was happening is that my version of VUE did not match the version of vue-loader and vue-template-compiler
To solve it I just had to match the versions in package.json and npm install
here are the versions I'm using
"vue": "^2.6.11",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",
"laravel-mix": "^6.0.6",
This work with me in laravel 8 the problem was from vue-loader version it was version 17.0.0 i changed it to 15.9.6 thanks Boutghat. –
Cardiomegaly
This worked for me as well. I think this issue occurs basically on MacBook. When using Windows PC, everything works fine with
"vue-loader": "^17.0.0"
. –
Medellin I don't think it has anything to do with the OS !! the issue occurred to me in both windows and linux –
Chouest
My issue arose after running php artisan ui vue --auth
. What happened is that this command added vue v2 as a dev dependency in my package.json
, while I had already installed vue 3.
Running npm install installed the version 2 vue, which led to a version mismatch with vue-loader
and vue-template-compiler
.
I solved the issue by getting rid of the added vue 2 dependency, and running npm install again.
Need to get rid of both of these: ` "vue": "^2.6.12", "vue-template-compiler": "^2.6.12" ` –
Noncompliance
© 2022 - 2024 — McMap. All rights reserved.
npm install @vue/compiler-sfc
. More info here: npmjs.com/package/@vue/compiler-sfc – Ascospore