Next.js Discord

Discord Forum

To use Next.js' built-in Sass support, you first need to install `sass`.

Answered
dperolio posted this in #help-forum
Open in Discord
Avatar
I've just created a new Next.js project with 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?
Answered by dperolio
Thanks, got it working. Not sure why it wasn't, but it is now.
View full answer

15 Replies

Avatar
😢
Avatar
Bump.
Avatar
need a reproduction repo
Avatar
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.scss
Avatar
Weird, I can't even run yours.
Image
What 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.
Avatar
Thanks, got it working. Not sure why it wasn't, but it is now.
Answer
Avatar
Ugh, getting this again. So is my colleague.
No idea why or how to fix.