5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Vue.js】vue sass-loader エラー:Module build failed: TypeError: this.getResolve is not a function

Last updated at Posted at 2021-03-04

背景

Vue.js Cliをいじっていて、Sass記述したらエラーが出た

エラー

Failed to compile.
./src/index.vue?vue&type=style&index=0&id=2964abc9&scoped=true&lang=scss& (./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/index.vue?vue&type=style&index=0&id=2964abc9&scoped=true&lang=scss&)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
    at Object.loader

が出力され、テンプレートが表示できない

原因1

最初「sass-loader」が入ってないと言われ、以下記事の内容を元に互換性があるwebpackとsass-loaderをnpmインストールした、がまだ解決しない→scssがコンパイルされるようにはなった
以下記事参照:

原因2

よく見たらちゃんと書いてありました^ ^;

Syntax Error: Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.

解決

node-sassをアンインストールします

npm uninstall node-sass

次に、互換性のある、4.14.1をインストールします

npm install node-sass@4.14.1

参照

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?