Im on a M1 apple, so node-sass wont work for me. Every site I work on, I uninstall node-sass and install sass( also change nvm use 16.2.0 if anyone has that issue).
this has always worked, but today after doing so I get the following errors
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
So I went into node_modules/sass-loader/lib/loader.js and found this on line 46
const render = getRenderFuncFromSassImpl(options.implementation || require("node-sass"));
and changed it to
const render = getRenderFuncFromSassImpl(options.implementation || require("sass"));
Everything works, css is compiled.. but what I did seems like a hack,
- Is there a better way to do it?
- Will this break things in future?
- Why didn't it update automatically like the other 20 sites I work on?
You can set the implementation of
sass-loader
in yourpackage.json
so it will use value ofoptions.implementation
instead ofrequire("node-sass")
:As for your third question, the doc states that:
Maybe you still have
node-sass
listed as a dependency?