vue项目中stylus引入时报错解决

我在引入时遇到下面的问题

编译报错:
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

前提是webpack配置正确

  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'src': resolve('src'),
      'common': resolve('src/common')
    }

解决办法
先npm install stylus --save然后安装你少的page.json中依赖:npm install stylus-loader css-loader style-loader --save-dev注意还要查看下vue-loader的版本,太低的版本也是还会继续(比如Module build failed: TypeError: loader.charAt is not a function,就是版本低)可以通过npm install vue-loader@latest --save-dev 将vue-loader 更新到最新的版本

你可能感兴趣的:(Vue)