Skip to content

Module build failed (from ./node_modules/vue-loader/dist/index.js) #1973

Closed
@csteri

Description

@csteri

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)

Activity

vue-bot

vue-bot commented on Jul 5, 2022

@vue-bot

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!

itrack

itrack commented on Jul 11, 2022

@itrack

I have the same problem, possible a bug?

nouce

nouce commented on Jul 12, 2022

@nouce

Same issue here!

batFormat

batFormat commented on Jul 12, 2022

@batFormat

Same issue!

itrack

itrack commented on Jul 12, 2022

@itrack

@yyx990803 @sodatea Hi guys, seems to be a problem, could you investigate? Thank you!

haoqunjiang

haoqunjiang commented on Jul 13, 2022

@haoqunjiang
Member

Please open a new issue with the issue-helper, and provide the necessary information for us to reproduce the error.
A minimal reproduction is required.

csteri

csteri commented on Jul 13, 2022

@csteri
Author

Please open a new issue with the issue-helper, and provide the necessary information for us to reproduce the error. A minimal reproduction is required.

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

dima-ivanov-pdffiler

dima-ivanov-pdffiler commented on Jul 13, 2022

@dima-ivanov-pdffiler

Same issue!

he-yang

he-yang commented on Jul 14, 2022

@he-yang

Same issue, how to solve?

haoqunjiang

haoqunjiang commented on Jul 14, 2022

@haoqunjiang
Member

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.

Humni

Humni commented on Jul 18, 2022

@Humni

Version 15 works a treat, thanks @sodatea

shiliangL

shiliangL commented on Aug 16, 2022

@shiliangL

Same issue here!

TuKun33

TuKun33 commented on Aug 30, 2022

@TuKun33

Same issue!

I am using Vue3.x ,
vue-loader :
17.0.0
16.8.3
16.8.2

6 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @itrack@haoqunjiang@Humni@he-yang@batFormat

        Issue actions

          Module build failed (from ./node_modules/vue-loader/dist/index.js) · Issue #1973 · vuejs/vue-loader