node.jsnpmsassgulp-sass

Sass - TypeError: Cannot read properties of undefined (reading 'indexOf')


My build on the server failed today, suddenly, when doing its Sass thing it's always done for 4 years.

It runs in Docker so the image probably has a later npm than I have locally, since I don't tend to update things that work.

So I updated my local node and npm and replicated the issue.

TypeError: Cannot read properties of undefined (reading 'indexOf')
    at /Users/me/myCode/node_modules/sass/sass.dart.js:116832:12
    at Object.applyHooksTransformer (/Users/me/myCode/node_modules/sass/sass.dart.js:1863:14)
    at Object.initHooks (/Users/me/myCode/node_modules/sass/sass.dart.js:1843:251)
    at Object.initNativeDispatchContinue (/Users/me/myCode/node_modules/sass/sass.dart.js:1809:9)
    at Object.initNativeDispatch (/Users/me/myCode/node_modules/sass/sass.dart.js:1803:9)
    at Object.getNativeInterceptor (/Users/me/myCode/node_modules/sass/sass.dart.js:29308:13)
    at Object.getInterceptor$x (/Users/me/myCode/node_modules/sass/sass.dart.js:29569:16)
    at Object.set$compile$x (/Users/me/myCode/node_modules/sass/sass.dart.js:29636:16)
    at Object.main (/Users/me/myCode/node_modules/sass/sass.dart.js:24401:9)
    at main2 (/Users/me/myCode/node_modules/sass/sass.dart.js:26210:9)

The failure is spontaneous and unexpected.

My guess is that the Node Docker image was updated this weekend and this has broken Sass somehow.

Updates


Solution

  • Looks exactly like an error I just spotted yesterday. Check the version of node you are using in the docker image, if it's 21 or current just downgrade to 20.

    Looks like a common issue already: https://github.com/vercel/next.js/issues/57005