Node Sass with apple m1, Big Sur and arm64

 Error: Node Sass does not yet support your current environment: OS X Unsupported architecture (arm64) with Unsupported runtime (93)
 For more information on which environments are supported please see:
 https://github.com/sass/node-sass/releases/tag/v4.14.1
at module.exports (/Users/hhag/Desktop/test_gulp/node_modules/node-sass/lib/binding.js:13:13)
at Object.<anonymous> (/Users/hhag/Desktop/test_gulp/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/Users/hhag/Desktop/test_gulp/node_modules/gulp-sass/index.js:166:21)
at Module._compile (node:internal/modules/cjs/loader:1109:14)

this error occures when I start to use gulp. is there a solution for using gulp-sass with apple m1? thanks


Solution 1:

I also had issues installing node-sass on M1, and ended up using the opportunity to replace it with sass, as recommended on the LibSass deprecation notice.

https://sass-lang.com/blog/libsass-is-deprecated

The replacement was completely smooth, it worked on M1, and I couldn't notice any performance impact locally or on the CI.

Solution 2:

For npm > 6.9 you can switch your dependency to dart-sass/sass with just one line and from there just use sass as you would before.

npm install node-sass@npm:sass

Solution 3:

I think, you are using an M1 Mac. And node-sass currently doesn't support it natively. See: https://github.com/sass/node-sass/issues/3033

For now you can set target arch for running it through Rosetta with:

rm -rf node_modules
npm install --target_arch=x64