Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass not working for new project - Cannot read properties of undefined (reading 'pop') #57005

Open
1 task done
FreedCapybara opened this issue Oct 18, 2023 · 8 comments
Open
1 task done
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application.

Comments

@FreedCapybara
Copy link

FreedCapybara commented Oct 18, 2023

Link to the code that reproduces this issue

https://github.com/FreedCapybara/nextjs-sass-error

To Reproduce

  1. Create a new Next.js app
npx create-next-app@latest
√ What is your project named? ... nextjs-sass-error
√ Would you like to use TypeScript? ... Yes
√ Would you like to use ESLint? ... Yes
√ Would you like to use Tailwind CSS? ... No
√ Would you like to use `src/` directory? ... Yes
√ Would you like to use App Router? (recommended) ... Yes
√ Would you like to customize the default import alias (@/*)? ... No
  1. Add Sass, per the documentation https://nextjs.org/docs/pages/building-your-application/styling/sass
npm install --save-dev sass
  1. Rename src/app/page.module.css to src/app/page.module.scss and update the import in src/app/page.tsx
  2. Run the app
npm run dev
  1. Error page with
./src/app/page.module.scss
Cannot read properties of undefined (reading 'pop')

Current vs. Expected behavior

I expect the app to build and render the page, but the app crashes with Cannot read properties of undefined (reading 'pop').

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 21.0.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 13.5.6-canary.6
  eslint-config-next: 13.5.5
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, CLI (create-next-app)

Additional context

Occurs as far back as 12.3.2-canary.43, had trouble installing older versions.

@FreedCapybara FreedCapybara added the bug Issue was opened via the bug report template. label Oct 18, 2023
@github-actions github-actions bot added the create-next-app Related to our CLI tool for quickly starting a new Next.js application. label Oct 18, 2023
@termorey
Copy link

I got a similar error. Downgraded the Node JS version - the current solution for me.

@FreedCapybara
Copy link
Author

Yep, using the current 18.18.2 LTS worked a treat 👍 thank you!

The LTS page wasn't loading for me when I was updating Node, but for some reason the current/latest-features page was, so I got stuck with that.

I'll let an admin decide if they want to close this -- might be worth keeping open if upcoming Node versions are going to be a problem.

@mirismaili
Copy link
Contributor

mirismaili commented Oct 23, 2023

I encountered this error in my project, after upgrading from Node.js v20 to v21.0.0.

With Node.js v20.8.1, the same project is built successfully.


I use Next.js 13.5.6.

@sannajammeh
Copy link
Contributor

Getting this too in Node.js 21. Seems related to this: sass/dart-sass#2127

@moekhalil
Copy link

Same issue here, glad I didn't have to downgrade any packages after running pnpm update --save with v21.0.0, and just down grading to npm v20.8.1 did the trick.

@kaechele
Copy link

Fixed in nodejs 21.1.0.

@oscaralderete
Copy link

Same problem here, my Node version was 21.0.0, I upgraded Node by CLI following the @kaechele suggestion (the CLI automatically installed the 21.4.0 version) so it works fine now.
Thanks and a great 2024 for everybody!

@pablobiosca
Copy link

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application.
Projects
None yet
Development

No branches or pull requests

8 participants