question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module 'vue' can't resolved in app.js

See original GitHub issue
  • Laravel Mix Version: 6.0.5
  • Vue Version: 2.6.12
  • Laravel/Lumen-Framework: 5.8
  • Node Version: 15.4.0
  • NPM Version: 7.0.15
  • OS: Win10

Description:

I get the following error if I try to npx mix:

ERROR in ./resources/js/app.js 1:0-22
Module not found: Error: Can't resolve 'vue' in 'C:\myproject\resources\js'

ERROR in ./resources/js/store.js 1:0-22
Module not found: Error: Can't resolve 'vue' in 'C:\myproject\resources\js'

My webpack.mix.js look like this:

let mix = require('laravel-mix'),
    path = require('path');

mix.alias({
    'vue$': 'vue/dist/vue.esm.js',
    '@': path.resolve('resources'),
    'ext': path.resolve('node_modules'),
})

mix.vue({ version: 2, extractVueStyles: true });
mix.js('resources/js/app.js', 'dist')
mix.sass('resources/scss/app.scss', 'dist');

I just use the import statement in my app.js:

import Vue from 'vue';
import store from './store'

...

new Vue({
	router,
	store
}).$mount('#app');

Any Ideas? I used laravel-mix in version 2.0 before and it works.

Steps To Reproduce:

Just a npx mix… because I think I have a configuration problem. Btw.: If I try to use the LiveReloadPlugin it also drops the following error (maybe this info helps):

[webpack-cli] TypeError: compiler.plugin is not a function
    at LiveReloadPlugin.apply

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12

github_iconTop GitHub Comments

12reactions
hbakouanecommented, Apr 22, 2021

@realtebo

  • Go to your webpack.mix.js and add .vue() like that mix.js(‘resources/js/app.js’, ‘public/js’).vue() .postCss(‘resources/css/app.css’, ‘public/css’, [ // ]);
  • after that run npm run watch and it will ask you to run a command, run it, and done!
11reactions
Paramount22commented, Mar 19, 2021

You have to add .vue() to webpack.mix.js like this: mix.js(“resources/js/app.js”, “public/js”) .vue() .postCss(“resources/css/app.css”, “public/css”, [ ]);

  1. run command - npm install vue-template-compiler vue-loader@^15.9.5 --save-dev --legacy-peer-deps
  2. npm run watch And it will works
Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve vue, path not correct
This question ranks high in google, so I would add a settings for Vue 3. With Webpack 5 and Vue 3, the webpack...
Read more >
Module 'vue' can't resolved in app.js · Issue #2717 - GitHub
I just use the import statement in my app. js: import Vue from 'vue'; import store from './store' ... new Vue({ router, store...
Read more >
Module not found: Error: Can't resolve ' Vuejs - Laracasts
Hi... In the router section, we want to route the pages through Nested Routes, but there is a problem, it does not recognize...
Read more >
Can't resolve 'vue' - Get Help
I guess i's because the new vue-compiler can't find vue module. Now i konw how to tell it to resolve 'vue' from root(window)....
Read more >
Module not found: Error: Can't resolve 'ode_modulesue ...
I was able to fix this error by reinstalling previous version. npm install vue-loader@10.0.0 --save-dev. Gihan R 63. Source: stackoverflow.com ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found