To use Next.js' built-in Sass support, you first need to install `sass`.
Answered
dperolio posted this in #help-forum
dperolioOP
I've just created a new Next.js project with
Any ideas on what's going on?
npx create-next-app@latest. I've added an .scss file and added it to a page. However, I'm getting this error (see title). I have done as it said and installed sass and even node-sass in an attempt to get it to work, but the error persists. It is in my package.json and I have deleted my .next folder and recompiled but the error persists.Any ideas on what's going on?
15 Replies
dperolioOP
😢
dperolioOP
Bump.
need a reproduction repo
dperolioOP
I think you can literally just
npx create-next-app@latest and rename the global.css file to global.scss, npm i sass --save-dev and change the import to global.scssWhat version of Node are you using?
Using
pnpm instead let yours run.But you have no Sass file.
Adding a global.scss file to your project and
import "./global.scss"; to layout.tsx results in the same error for me.Oh, your project does... Why did it not clone correctly? 🤔
Yours does indeed work.
dperolioOP
Thanks, got it working. Not sure why it wasn't, but it is now.
Answer
dperolioOP
Ugh, getting this again. So is my colleague.
No idea why or how to fix.