nuxt运行报错:Module build failed (from ./node_modules/_sass-loader@13.2.0@sass-loader/dist/cjs.js)TypeError: this.getOptions is not a function
Vue
2023-02-21 23:15:08
nuxt框架运行报错,报错如下:
Module build failed (from ./node_modules/_sass-loader@13.2.0@sass-loader/dist/cjs.js): friendly-errors 23:03:22
TypeError: this.getOptions is not a function
at Object.loader (D:\work\nuxt-seo\node_modules\_sass-loader@13.2.0@sass-loader\dist\index.js:27:24)
friendly-errors 23:03:22
@ ./node_modules/vue-style-loader??ref--7-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modu
les/_sass-loader@13.2.0@sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=style&index=0&lang=scss& 4:14-389 14:3-18:5 15:22-397
@ ./layouts/default.vue?vue&type=style&index=0&lang=scss&
@ ./layouts/default.vue
@ ./.nuxt/App.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi eventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&name=client&path=/__webpack_hmr/client ./.nuxt/client.js
报错原因解析:
node node-sass sass-loader 版本不匹配
解决办法:
//淘宝镜像
cnpm install sass-loader@7.0.3
//npm
npm install sass-loader@7.0.3
本项目中相关版本信息:
"devDependencies": {
"node-sass": "^8.0.0",
"sass-loader": "^7.0.3"
}
切换成指定的sass-loader版本后,从新运行即可。
六月初字帖坊小程序
你想要的字帖模板及工具,这里都有!
881篇文章
2746人已阅读