dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.15k stars 3.63k forks source link

升级版本之后,出现scss无法编译情况 #1267

Closed nxboo closed 2 years ago

nxboo commented 4 years ago

问题描述 项目为npm方式创建 更新原来项目正常(2.0.0-24220191115011),更新到(^2.0.0-25520200111001)之后出现

ERROR Failed to compile with 1 errors 11:17:45 AM

error in ./src/components/uni-number-box/uni-number-box.vue?vue&type=style&index=0&id=0bbad3e2&lang=scss&scoped=true&

Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Invalid argument(s): Unsupported output style "nested".

@ ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue-style-loader??ref--8-oneOf-1-0!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-1!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-2!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-3!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-5!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader!./src/components/uni-number-box/uni-number-box.vue?vue&type=style&index=0&id=0bbad3e2&lang=scss&scoped=true& 4:14-823 14:3-18:5 15:22-831 @ ./src/components/uni-number-box/uni-number-box.vue?vue&type=style&index=0&id=0bbad3e2&lang=scss&scoped=true& @ ./src/components/uni-number-box/uni-number-box.vue @ ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--16-0!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/filter-modules-template.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-scoped-loader!./src/pages/cart/index.vue?vue&type=template&id=72707db2&scoped=true& @ ./src/pages/cart/index.vue?vue&type=template&id=72707db2&scoped=true& @ ./src/pages/cart/index.vue @ ./src/pages.json @ ./src/main.ts @ multi (webpack)-dev-server/client?http://192.168.31.78:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

复现步骤 [复现问题的步骤] npm run dev:h5

[或者可以直接贴源代码]

系统信息: uni-app v2.5.5 uni-app cli v2.0.0-alpha-25520200111001

Environment Info:

System: OS: macOS 10.14.6 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Binaries: Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node Yarn: 1.13.0 - ~/.nvm/versions/node/v10.16.0/bin/yarn npm: 6.13.0 - ~/.nvm/versions/node/v10.16.0/bin/npm Browsers: Chrome: 78.0.3904.108 Firefox: 70.0.1 Safari: 12.1.2 npmPackages: @dcloudio/types: * => 0.4.1 @dcloudio/uni-app-plus: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-app-plus-nvue: 0.0.1 @dcloudio/uni-app-plus-nvue-v8: 0.0.1 @dcloudio/uni-cli-shared: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-h5: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-helper-json: ^1.0.4 => 1.0.5 @dcloudio/uni-migration: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-mp-alipay: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-mp-baidu: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-mp-qq: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-mp-toutiao: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-mp-weixin: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/uni-stat: ^2.0.0-24220191115011 => 2.0.0-24220191115011 (2.0.0-v3-24020191018001) @dcloudio/uni-template-compiler: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/vue-cli-plugin-hbuilderx: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/vue-cli-plugin-uni: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/vue-cli-plugin-uni-optimize: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/webpack-uni-mp-loader: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @dcloudio/webpack-uni-nvue-loader: 0.0.1 @dcloudio/webpack-uni-pages-loader: ^2.0.0-25520200111001 => 2.0.0-alpha-25520200111001 @vue/babel-helper-vue-jsx-merge-props: 1.0.0 @vue/babel-plugin-transform-vue-jsx: 1.1.2 @vue/babel-preset-app: 3.12.1 @vue/babel-preset-jsx: 1.1.2 @vue/babel-sugar-functional-vue: 1.1.2 @vue/babel-sugar-inject-h: 1.1.2 @vue/babel-sugar-v-model: 1.1.2 @vue/babel-sugar-v-on: 1.1.2 @vue/cli-overlay: 4.1.2 @vue/cli-plugin-babel: 3.5.1 => 3.5.1 @vue/cli-plugin-router: 4.1.2 @vue/cli-plugin-typescript: ^3.5.1 => 3.12.1 @vue/cli-plugin-vuex: 4.1.2 @vue/cli-service: ^4.1.2 => 4.1.2 @vue/cli-shared-utils: 3.12.1 @vue/component-compiler-utils: 3.1.0 @vue/preload-webpack-plugin: 1.1.1 @vue/web-component-wrapper: 1.2.0 mpvue-page-factory: 1.0.1 mpvue-template-compiler: 1.0.13 uni-h5-vue: 2.6.10 uni-mp-vue: 2.6.10 vue: ^2.6.11 => 2.6.11 vue-class-component: ^6.3.2 => 6.3.2 (7.1.0) vue-hot-reload-api: 2.3.4 vue-loader: 15.8.3 vue-property-decorator: ^8.0.0 => 8.3.0 vue-router: 3.0.1 vue-style-loader: 4.1.2 vue-template-compiler: ^2.6.11 => 2.6.11 vue-template-es2015-compiler: 1.9.1 vuex: ^3.0.1 => 3.1.2 vuex-class: ^0.3.2 => 0.3.2 vuex-module-decorators: ^0.11.0 => 0.11.0 npmGlobalPackages: @vue/cli: 4.0.5

yuconora commented 4 years ago

可以尝试 把 vue cli 版本降级一下

yarn global add @vue/cli@3.12.1

或者把 sass-loader 版本降为 ^7.3.0

fxy060608 commented 4 years ago

报错时的 node-sass 和 sass-loader 版本号是多少?