Encountering the error "Module build failed (from ./node_modules/sass-loader/dist/cjs.js)" while executing the command npm serve

After spending a significant amount of time working on a Vue/Vuetify project, everything seemed to be functioning perfectly until yesterday. The trouble began when I encountered issues with utilizing the <v-simple-table> Vuetify component. In an attempt to resolve this, I decided to run npm install and re-install Vuetify, but that decision turned out to be quite detrimental.

The current challenge I am facing is that whenever I run npm run serve, I encounter the following error repeatedly:

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
 - options has an unknown property 'indentedSyntax'. These properties are valid:
   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (C:\Users\Jeroen\Documents\favourite_xi\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:49:11)
    at Object.loader (C:\Users\Jeroen\Documents\favourite_xi\node_modules\sass-loader\dist\index.js:36:28)

 @ ./node_modules/vuetify/src/components/VCalendar/mixins/calendar-with-events.sass 4:14-225 14:3-18:5 15:22-233
 @ ./node_modules/vuetify/lib/components/VCalendar/mixins/calendar-with-events.js
 @ ./node_modules/vuetify/lib/components/VCalendar/VCalendar.js
 @ ./node_modules/vuetify/lib/components/VCalendar/index.js
 @ ./node_modules/vuetify/lib/components/index.js
 @ ./node_modules/vuetify/lib/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.178.115:8080/sockjs-node ./node_modules/@vue/cli-service/node_modules/webpack/hot/dev-server.js ./src/main.js

This is my main.js file:

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import Vuetify from 'vuetify/lib'
import 'vuetify/dist/vuetify.min.css'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.use(BootstrapVue)
Vue.use(Vuetify, {
  theme: {
    "primary": "#FFCA28",
    "secondary": "#1976D2",
    "accent": "#82B1FF",
    "error": "#FF5252",
    "info": "#2196F3",
    "success": "#4CAF50",
    "warning": "#FB8C00"
  }
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

I've attempted various solutions recommended by other users such as running npm rebuild node-sass in both regular and admin mode, deleting the node-modules folder, and reinstalling sass-loader. However, none of these fixes have resolved the issue so far.

Could there possibly be a fault in my main.js file?

Your assistance would be greatly appreciated! Please let me know if you require additional code snippets or information.

Edit: included package.json for reference

{
  "name": "favourite_xi",
  "version": "0.1.0",
  "private": true,
  // Remaining content of the package.json file...
}

Answer №1

It appears that the issue may be related to updating sass-loader from version 7.x to 8.x.

According to the release notes, there have been significant configuration changes.

To address this, please review your vue.config.js file. If you come across something similar to the following:

module.exports = {
  css: {
    loaderOptions: {
      sass: {
        ....some options here...
      }
    }
  }
}

Make sure to update it to the following structure:

module.exports = {
  css: {
    loaderOptions: {
      sass: {
        sassOptions: {
          ....some options here...
        }
      }
    }
  }
}

Answer №2

It seems that my npm run build encounters errors with the color codes in the theme section. Interestingly, when I remove the color code lines, the build process runs without any errors:

    Vue.use(Vuetify, {
      theme: {
        "primary": "#FFCA28",
        "secondary": "#1976D2",
        "accent": "#82B1FF",
        "error": "#FF5252",
        "info": "#2196F3",
        "success": "#4CAF50",
        "warning": "#FB8C00"
      }
    })

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Secure User Authentication using HTML and JavaScript Box

In the given code, I am attempting to implement a functionality where a message is displayed next to the select box if it does not have a value of male or female. This message should not be shown if one of these values is selected. However, this feature ...

Troubleshooting Vue 3: Issues with retrieving input field values

Vue 3 has been a bit challenging for me to grasp, especially related to making axios calls and handling input field values. In my Vue installation folder, I am trying to retrieve input values from the form fields to implement a login function which at lea ...

Nuxt encountering a critical issue: "module 'dir-glob' not found"

Recently, while running my Nuxt app, I encountered an error after restarting the server using npm run dev. The error message stated that it couldn't find the module 'dir-glob'. Despite finding a similar issue on Stack Overflow related to Ang ...

Is there a way to leverage the "locals" parameter in the jade compile() function on the client-side?

My Objective The server is a Node.js application. My goal is to share code with the client using Jade template helpers (for functions) or globals (for objects/variables). Any new helpers and globals should be accessible in every client template. This quer ...

Tips on how to connect the scope from a controller to a custom directive in Angular

Currently, I am delving into the world of Angular and finding myself immersed in directive lessons. However, as I engage in some practice exercises, I have encountered a stumbling block. Specifically, I have developed a custom directive with the intention ...

What is the inner workings of the AngularJS Digest Cycle?

As a newcomer to AngularJS, I am currently following a tutorial to learn more about it. One concept that has caught my attention is the Digest Loop in Angular. In my application, there are two main files: 1) index.html: <!DOCTYPE html> <html la ...

Exploring the Challenge of Verification in 'Element-UI' Form Validation Inquiry

key feature <el-form :model="form" :rules="rules"> <div v-for="(item, index) in form.involveUsers" :key="index"> <el-form-item label="mechanismName" :prop="`involveUsers.${index}.mec ...

The property 'createUploadWidget' cannot be read from an undefined source

While working on a React js tutorial, I encountered an issue related to using Cloudinary React SDK for image and video uploads. Specifically, I was using the Upload Widget provided by Cloudinary and faced an error when trying to open the widget - 'Typ ...

Show informational pop-up when hovering over selected option

My goal is to create an information box that appears when a user hovers over a select option. For example: <select id = "sel"> <option value="sick leave">Sick leave</option> <option value="urgent leave">Urgent lea ...

Experimenting with the speechSynthesis API within an iOS webview application

I'm currently working on developing an app that features TTS capabilities. Within my webview app (utilizing a React frontend compiled with Cordova, but considering transitioning to React Native), I am implementing the speechSynthesis API. It function ...

Shortcuts for $scope variables in AngularJS templates

Within my controller, I often set: $scope.currentThing.data For different parts of my template, sometimes I require currentThing.data.response[0].hello and other times currentThing.data.otherStuff[0].goodbye //or currentThing.data.anotherThing[0].goo ...

The outcomes of my JavaScript code are not aligning with my expectations

I've been experimenting with printing objects from an API using JSON and AJAX, and I noticed that the console.log works perfectly to display the output. However, I'm having a bit of trouble with my generateCreatureDiv function as it doesn't ...

`The post route in the Express app is encountering an issue where req.body is not

Here is my router config: router.post('/', async(req, res) => { const posts = await loadPostsCollection() await posts.insertOne({ text: req.body.text, createdAt: new Date() }) res.status(201).send() }) An error has occurred in the ...

Using JavaScript to store a JSON string as the value of an input field (Escaping/Unescaping)

Here is the scenario to consider (view plunker here: http://plnkr.co/edit/fOJ5zRvqCKvOC3olik8S?p=preview): https://i.sstatic.net/8fz6s.png <input ng-model="x" type="text"> <button ng-click="add(x)"> push input's value </button> Th ...

I have a query related to material-ui 4, specifically the material-ui/pickers component that is reporting an error regarding a non-existent "mask" property

Recently, I upgraded a reactjs project that uses Material-UI (mui) from version 3 to version 4 by following the recommended migration guide. In the process, I also replaced material-ui-pickers 2.2.1 with @material-ui/pickers. However, after the upgrade, t ...

Exploring Angular: Techniques for searching within nested arrays

I am looking for a function that can search and filter the largest value in a nested array, and then return the parent scope. Here is an example of my array: data = {"people": [{"male": [ {"name": "Bob" ,"age": "32"}, {"name":"Mike", "age ...

I am able to access the JSON file from the URL without any issues, but for some reason, I am unable to fetch it using $

(function(){ $(document).ready(function(){ $.getJSON('http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=AAPL&callback=?', function(){console.log("function was run");}); }); }()) I recently delved into working with APIs. Ho ...

Building an Angular module that allows for customizable properties: A step-by-step guide

I am in the process of developing an AngularJS module that will simplify interactions with my product's REST API. Since my product is installed on-premise, each user will need to provide their own URL to access the API. Therefore, it is essential that ...

Is it possible to determine if the user is able to navigate forward in browser history?

Is there a way to check if browser history exists using JavaScript? Specifically, I want to determine if the forward button is enabled or not Any ideas on how to achieve this? ...

What is the reason for function components running in multiples of 2 when the state changes?

I need help with a React question that I can't quite figure out. I have a component where new data keeps getting added to the existing data. Initially, it makes sense for two console logs to appear due to Mount and Update. But after that, why do 4 con ...