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

NodeJS v21 ua.indexOf throws TypeError: Cannot read properties of undefined (reading 'indexOf') #2123

Closed
ShenHongFei opened this issue Oct 18, 2023 · 7 comments

Comments

@ShenHongFei
Copy link

I upgraded to NodeJS v21

D:\2\ddb\web\node_modules\.pnpm\sass@1.69.4\node_modules\sass\sass.dart.js:116832
    if (ua.indexOf("DumpRenderTree") >= 0) return hooks;

TypeError: Cannot read properties of undefined (reading 'indexOf')
    if (typeof navigator != "object") return hooks;
    var ua = navigator.userAgent;
    if (ua.indexOf("DumpRenderTree") >= 0) return hooks;

Then I replaced all navigator.userAgent in the file with navigator.userAgent || '' and it worked normally

@lianyitj
Copy link

1697604337918 1697604661610

same error,...

@inoyakaigor
Copy link

Met the same error
image
in this code
image

dart-sass@1.63.2 / Node.js@21 / Win 11

@Skyost
Copy link

Skyost commented Oct 18, 2023

Same here.

Error:  Nuxt Build Error: Preprocessor dependency "sass" failed to load:
Cannot read properties of undefined (reading 'indexOf')
  at node_modules/sass/sass.dart.js:116832:12
  at Object.applyHooksTransformer (node_modules/sass/sass.dart.js:1863:14)
  at Object.initHooks (node_modules/sass/sass.dart.js:1843:251)
  at Object.initNativeDispatchContinue (node_modules/sass/sass.dart.js:1809:9)
  at Object.initNativeDispatch (node_modules/sass/sass.dart.js:1803:9)
  at Object.getNativeInterceptor (node_modules/sass/sass.dart.js:29308:13)
  at Object.getInterceptor$x (node_modules/sass/sass.dart.js:29569:16)
  at Object.set$compile$x (node_modules/sass/sass.dart.js:29636:16)
  at Object.main (node_modules/sass/sass.dart.js:24401:9)
  at main2 (node_modules/sass/sass.dart.js:26210:9)
  at node_modules/sass/sass.dart.js:117902:7
  at node_modules/sass/sass.dart.js:117881:7
  at dartProgram (node_modules/sass/sass.dart.js:117896:5)
  at _cliPkgExports.load (node_modules/sass/sass.dart.js:117904:3)
  at Object.<anonymous> (node_modules/sass/sass.node.js:4:9)
  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 loadPreprocessor (node_modules/vite/dist/node/chunks/dep-bb8a8[339](https://github.com/Skyost/Agregation/actions/runs/6559774470/job/17816040333#step:6:340).js:39299:45)
  at scss (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:39[345](https://github.com/Skyost/Agregation/actions/runs/6559774470/job/17816040333#step:6:346):20)
  at compileCSSPreprocessors (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38770:36)
  at compileCSS (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38820:42)
  at async Object.transform (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38300:56)
  at async transform (node_modules/rollup/dist/es/shared/node-entry.js:24449:16)
  at async ModuleLoader.addModuleSource (node_modules/rollup/dist/es/shared/node-entry.js:24649:30)
  Error: Preprocessor dependency "sass" failed to load:
  Cannot read properties of undefined (reading 'indexOf')
  at loadPreprocessor (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:39307:29)
  at scss (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:39345:20)
  at compileCSSPreprocessors (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38770:36)
  at compileCSS (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38820:42)
  at async Object.transform (node_modules/vite/dist/node/chunks/dep-bb8a8339.js:38300:56)
  at async transform (node_modules/rollup/dist/es/shared/node-entry.js:24449:16)
  at async ModuleLoader.addModuleSource (node_modules/rollup/dist/es/shared/node-entry.js:24649:30)

@ntkme
Copy link
Contributor

ntkme commented Oct 18, 2023

dart-lang/sdk#53784

@nex3 nex3 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
@stheine
Copy link

stheine commented Oct 19, 2023

@nex3 , can you explain why this is getting closed?
isn't this an issue that exists in node 21 and that needs fixing?

@inoyakaigor
Copy link

@stheine because of this I guess dart-lang/sdk#53784

@nex3
Copy link
Contributor

nex3 commented Oct 19, 2023

That's right. This is an issue with the dart2js compiler; we can't fix it in Sass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants