LoginSignup
0
0

More than 1 year has passed since last update.

`Uncaught Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js)` の解決法

Last updated at Posted at 2021-06-12

Dockerを利用した個人開発で遭遇した下記エラーの対処方法について解説します。

Uncaught Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding /myapp/node_modules/node-sass/vendor/linux-x64-72/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 12.x

開発環境

$ sw_vers
ProductName:    macOS
ProductVersion: 11.3
BuildVersion:   20E232

解決策

docker-compose run --rm <container_name> yarn add node-sass --force

docker-compose経由でDockerコンテナ上でアプリケーションを開発していたにもかかわらずdocker-composeコマンドを使わずyarn addしてしまったため、ホスト(Mac OS X)環境用のnpmライブラリがインストールされてしまっていたことが原因だとわかりました。

再ビルドすることで、Dockerコンテナ上のLinux用のnode-sassをインストールでき、無事エラーが解決しました。

0
0
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
0
0