Search code examples
node.jsvue.jsnpmvue-clistylus

Sass Loader Error: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema


I'm getting this error after running npm run serve:

in ./src/components/site-checker/insert-model.vue?vue&type=style&index=0&lang=stylus&

Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'preferPathResolver'. These properties are valid:
   object { stylusOptions?, sourceMap?, webpackImporter?, additionalData? }

I'm using VueJS with this framework:

[Vue 2] babel, router, vuex Vue CLI v4.5.8


Solution

  • This is a result of a recent compatibility issue between stylus-loader and vue-cli. It was recently fixed in Vue's dev branch.

    The best bet for now is to downgrade stylus-loader to version 3

    npm install stylus-loader@3
    

    You can also try upgrading your vue-cli to the latest version:

    npm update -g @vue/cli

    OR

    yarn global upgrade --latest @vue/cli