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

Node 21 error: Cannot read properties of undefined (reading 'pop') #2127

Closed
DawidJanczak opened this issue Oct 23, 2023 · 10 comments
Closed
Assignees

Comments

@DawidJanczak
Copy link

Hello,

We're getting the above mentioned error after upgrading Node to 21. We're using webpack and sass-loader if this changes anything. Here's the stacktrace:

ERROR in ./src/styles/ui_components/_tabs.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[7].use[2]!./src/styles/ui_components/_tabs.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: Cannot read properties of undefined (reading 'pop')
    at Object.<anonymous> (/var/app/node_modules/sass/sass.node.js:2:43)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1201:32)
    at Module._load (node:internal/modules/cjs/loader:1017:12)
    at Module.require (node:internal/modules/cjs/loader:1229:19)
    at require (node:internal/modules/helpers:177:18)
    at getDefaultSassImplementation (/var/app/node_modules/sass-loader/dist/utils.js:37:10)
    at getSassImplementation (/var/app/node_modules/sass-loader/dist/utils.js:46:30)
    at Object.loader (/var/app/node_modules/sass-loader/dist/index.js:23:55)
 @ ./src/styles/ui_components/_tabs.scss 8:6-208 22:17-24 26:7-21 52:25-39 53:36-47 53:50-64 57:6-67:7 58:54-65 58:68-82 64:42-53 64:56-70 66:21-28 77:0-178 77:0-178 78:22-29 78:33-47 78:50-64 55:4-68:5
 @ ./src/components/tabs.ts 2:0-44
 @ ./src/entry_points/interproject.ts 5:0-28

Reported line looks like this const library = globalThis._cliPkgExports.pop(); so it looks like globalThis._cliPkgExports is undefined.

@euaaaio
Copy link

euaaaio commented Oct 23, 2023

Seems to be related to dart-lang/sdk#53784

@DawidJanczak
Copy link
Author

I was thinking about that, but all occurrences of that other error mention indexOf and there's no references to navigator in this code. But still could be that, I'll definitely re-test it when that fix is in :)

@euaaaio
Copy link

euaaaio commented Oct 23, 2023

Yeah. That's why I mentioned them here.
It scares me more that they haven't released a fix in 5 days.

@gajus
Copy link

gajus commented Oct 23, 2023

Same here. Vite fails with:

  [WebServer] Preprocessor dependency "sass" failed to load:
  Cannot read properties of undefined (reading 'indexOf')
  [WebServer] Preprocessor dependency "sass" failed to load:
  Cannot read properties of undefined (reading 'pop')
  [WebServer] 1:18:33 PM [vite] Internal server error: Preprocessor dependency "sass" failed to load:
#13 76.70 @contra/slate:build: [vite:css] Preprocessor dependency "sass" failed to load:
#13 76.70 @contra/slate:build: Cannot read properties of undefined (reading 'indexOf')
#13 76.70 @contra/slate:build: file: /srv/packages/slate/src/editor/components/Key/Key.module.scss?used
#13 76.70 @contra/slate:build: error during build:
#13 76.70 @contra/slate:build: TypeError: Cannot read properties of undefined (reading 'indexOf')
#13 76.70 @contra/slate:build:     at /srv/node_modules/.pnpm/[email protected]/node_modules/sass/sass.dart.js:116798:12

Pasting in the error so Vite folks discover the thread when Google-ing it.

@nex3 nex3 self-assigned this Oct 23, 2023
@nex3
Copy link
Contributor

nex3 commented Oct 23, 2023

Can someone provide a minimal reproduction for this? I've tried manually editing sass.dart.js to work around dart-lang/sdk#53784, but when I do so Dart Sass loads and runs fine in Node 21 for me (via both ESM and CJS loads). It seems to work through WebPack as well.

@sannajammeh
Copy link

sannajammeh commented Oct 24, 2023

Getting this as well in the latest Next.js 13.5.6 pages directory.

stack:

../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[7].oneOf[9].use[1]!../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[7].oneOf[9].use[2]!../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[7].oneOf[9].use[3]!../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[7].oneOf[9].use[4]!./components/ui/ScrollArea.module.scss
./components/ui/ScrollArea.module.scss
./components/ui/ScrollArea.tsx

dart-lang/sdk@8fdf766

Appears its already fixed on dart-sass end

@VishnuJin
Copy link

VishnuJin commented Oct 24, 2023

facing the same with Vite, any workarounds other than downgrade of nodejs?

@sannajammeh
Copy link

facing the same with Vite, any workarounds other than downgrade of nodejs?

Unfortunately its the only work around

@sebmaz93
Copy link

sebmaz93 commented Oct 25, 2023

@VishnuJin upgrading to node v21.1.0 fixed the issue for me

@nex3
Copy link
Contributor

nex3 commented Oct 27, 2023

Since this seems to be fixed in Node 21.1, I'm closing it out.

@nex3 nex3 closed this as completed Oct 27, 2023
EDM115 added a commit to data-fair/app-charts that referenced this issue Jan 24, 2024
…css issue

- the store is initialized in plugins/init.js like it was before, using the env object
- this env is set to empty if not retrieved
- import '../styles/settings.scss' is now valid, node 20 bug apparently, more info here :
  * vuejs/vitepress#3102
  * sass/dart-sass#2127
  * dart-lang/sdk#53784
- the data is set to data.data as soon as we get it from axios, removing further problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants