欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Stylus| vue项目中stylus和stylus-loader版本兼容问题

程序员文章站 2022-03-12 21:53:08
Stylus| vue项目中stylus和stylus-loader版本兼容问题报错代码:in ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=stylus&scoped=true&Module build failed (from ./node_modules/stylus-loader/dist/cjs.js):ValidationError: Invalid options objec...

Stylus| vue项目中stylus和stylus-loader版本兼容问题

报错代码:

in ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=stylus&scoped=true&

Module build failed (from ./node_modules/stylus-loader/dist/cjs.js):
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? }
    at validate (E:\CODE\WebWorkspace\take-out\node_modules\stylus-loader\node_modules\schema-utils\dist\validate.js:104:11)
    at Object.stylusLoader (E:\CODE\WebWorkspace\take-out\node_modules\stylus-loader\dist\index.js:24:29)

 @ ./node_modules/vue-style-loader??ref--11-oneOf-1-0!./node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--11-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--11-oneOf-1-2!./node_modules/stylus-loader/dist/cjs.js??ref--11-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=stylus&scoped=true& 4:14-477 14:3-18:5 15:22-485
 @ ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=stylus&scoped=true&
 @ ./src/App.vue
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.1.102:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

此时对应版本为 “stylus”: “^0.54.8”, “stylus-loader”: “^4.3.1”,

解决办法:更改版本号 stylus 0.54.5 stylus-loader 3.0.1 再重新安装依赖即可
npm install

看了好几个回答 似乎less和sass都同样有一样的问题,应该更改能用的版本就好了。

本文地址:https://blog.csdn.net/Aeroxian/article/details/111136795

相关标签: vue.js css3