事象

パッケージ全体をアップグレートしたら下記メッセージが出現

#!/bin/bash -eo pipefail
yarn run generate
yarn run v1.22.5
$ nuxt generate
[fatal] Nuxt build error
  ERROR in ./pages/blog/_slug.vue?vue&type=style&index=0&id=0d993308&lang=scss&scoped=true& (./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_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./pages/blog/_slug.vue?vue&type=style&index=0&id=0d993308&lang=scss&scoped=true&)
  Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
  TypeError: this.getOptions is not a function
  at Object.loader (node_modules/sass-loader/dist/index.js:25:24)
  @ ./pages/blog/_slug.vue?vue&type=style&index=0&id=0d993308&lang=scss&scoped=true& (./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_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./pages/blog/_slug.vue?vue&type=style&index=0&id=0d993308&lang=scss&scoped=true&) 4:14-406
  @ ./pages/blog/_slug.vue?vue&type=style&index=0&id=0d993308&lang=scss&scoped=true&
  @ ./pages/blog/_slug.vue
  @ ./node_modules/.cache/nuxt/router.js
  @ ./node_modules/.cache/nuxt/index.js
  @ ./node_modules/.cache/nuxt/client.js
  @ multi ./node_modules/.cache/nuxt/client.js

   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1
CircleCI received exit code 1

原因・解決策

最新のsass-loaderとvue (@2.6.12) との相性が良くないようだ(2021/2/8時点)
取り急ぎsass-loaderをダウングレードすることで解決
sass-loader@11.0.0 → sass-loader@10.1.1

  1. package.jsonを上記バージョンの通り編集
  2. rm -rf node_modules
  3. nuxt generate or yarn run dev など

参考