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 build failed (from ./node_modules/vue-loader/dist/index.js)

See original GitHub issue

I get this error after running npm run dev and I get this error in the terminal:

ERROR in ./resources/js/erp/components_VueJs/example.vue Module build **failed** (from ./node_modules/vue-loader/dist/index.js): TypeError: Cannot read properties of undefined (reading 'styles') at Object.loader (C:\laragon\www\erp\node_modules\vue-loader\dist\index.js:70:34)

My package.json is:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },

    "devDependencies": {
        "axios": "^0.25",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^5.0.0",
        "sass": "^1.53.0",
        "sass-loader": "^13.0.2",
        "vue-loader": "^17.0.0",
        "vue-template-compiler": "^2.7.2",
        "webpack": "^5.73.0"
    },
    "dependencies": {
        "@fortawesome/fontawesome-free": "^6.1.1",
        "@popperjs/core": "^2.11.5",
        "bootstrap": "^5.1.3",
        "bootstrap-icons": "^1.8.3",
        "vue": "^2.7.2"
    }
}

and webpack.mix.js is:


mix.js('resources/js/erp/app.js', 'public/js/erp')
      .js('resources/js/site/app.js', 'public/js/site')
      .js('resources/js/erp/vueApp.js', 'public/js/erp').vue()
    .postCss('resources/css/erp/app.css', 'public/css/erp', [])
    .postCss('resources/css/site/app.css', 'public/css/site', [])
    .sass("resources/scss/erp/app.scss", "public/css/erp")
    .sass("resources/scss/site/app.scss", "public/css/site")
    .webpackConfig({
        plugins: [
        ],
        resolve: {
        },
        stats: {
            children: true
        }
    });

and app.js

import Vue from 'vue';
window.Vue = require('vue');

Vue.component('example-comp', require('./components_VueJs/example.vue').default);

For installation I used the following commands: npm install vue@2.x.x npm install -D vue-loader vue-template-compiler npm run dev (and here the error appears)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
sodateacommented, Jul 14, 2022

It is a compatibility issue between VueJs2 and vue-loader = 17.0.0

Use vue-loader@15 for Vue.js 2. 16 & 17 are only compatible with Vue 3.

2reactions
vue-botcommented, Jul 5, 2022

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

Read more comments on GitHub >

github_iconTop Results From Across the Web

0 - Stack Overflow
Module build failed (from ./node_modules/vue-loader/dist/index.js): friendly-errors 15:42:31 TypeError: Cannot read property 'styles' of ...
Read more >
Error: ENOENT: no such file or directory index.js.map · Issue #84
Module build failed: Error: ENOENT: no such file or directory index.js.map #84 ... node_modules/rxjs/_esm5/index.js which DOES exist.
Read more >
Angular - Code with Mosh Forum
Error : Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): · delete the node_modules folder · delete package-lock.json ...
Read more >
Get Help and Help Others - RedwoodJS Community
Compiled with problems:X ERROR in ./src/components/Button/Button.tsx Module build failed (from ../node_modules/babel-loader/lib/index.js):.
Read more >
Sign in - YouTube
Module build failed (from ./node_modules/source-map-loader/dist/cjs. js ): Error: ENOENT: no such file or directory, ...
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