1. 程式人生 > >vue中使用stylus報錯問題

vue中使用stylus報錯問題

onf amp false alt inf nts nim conf pen

已安裝stylus-loader、css-loader、style-loader
webpack已配置:

{test:/\.css$/,loader:‘style-loader!css-loader!stylus-loader‘}

.vue文件使用

<style lang="stylus">
.container
width:1100px
margin:0 auto
</style>

編譯報錯:
This dependency was not found:

* !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../node_modules/vue-loader/lib/style-rewriter?{"id":"data-v-6c96342b","scoped":false,"hasInlineConfig":false}!stylus-loader?{"sourceMap":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./navs.vue in ./src/components/navs.vue

To install it, you can run: npm install --save !!vue-style-loader!css-loader?{"minimize":false,"sourceMap":false}!../../node_modules/vue-loader/lib/style-rewriter?{"id":"data-v-6c96342b","scoped":false,"hasInlineConfig":false}!stylus-loader?{"sourceMap":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./navs.vue

應該是package.json缺了幾個依賴, 不能解析lang="stylus" rel="stylesheet/stylus",我在終端中重新輸入npm install stylus-loader css-loader style-loader --save-dev 之後好了!

技術分享圖片

vue中使用stylus報錯問題