LoginSignup
5
0

More than 1 year has passed since last update.

さらば Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

Last updated at Posted at 2021-10-06

node-sass インストール時のエラー

SCSS を使いたくて node-sass インストールしたら yarn start でエラー吐いた。

Terminal
$ yarn add node-sass
$ yarn start
Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

日本語訳
NODE SASS バージョン 6.0.1 は ^4.0.0 と互換性がありません。

ネット上を探してみると node-sass をバージョン指定でインストールすれば OK みたいな記事が多くヒットするけど、そもそも npm : node-sass に以下の記載がありました。

Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.

日本語訳
警告 : LibSass と NodeSass は非推奨です。今後もメンテナンスは継続されますが、新規機能の追加や、新しい CSS または Sass 機能との互換性の追加は行われません。まだこれらを使用しているプロジェクトは Dart Sass に移行する必要があります。

これからは Dart Sass 使ってね!ってことみたいです。

Node Sass のアンインストール

特に Node Sass に思い入れがある訳でもないので、サクッと node-sass を削除します。

Terminal
$ yarn remove node-sass

Dart Sass のインストール

Dart Sass をインストールします。パッケージ名が dart-sass ではなく sass なので注意。

Terminal
$ yarn add sass

コンパイル

早速、や~んスタート!

Terminal
$ yarn start
Compiled successfully!
You can now view ReactTest in the browser.       
  Local:            http://localhost:3000        
  On Your Network:  http://172.18.112.1:3000     
Note that the development build is not optimized.
To create a production build, use yarn build. 

解決!

参考サイト様

5
0
1

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
0