Runtime error: Cannot read property 'bind' of undefined in latest Clean-CSS 5.0
See original GitHub issueRuntime error: Cannot read property ‘bind’ of undefined in latest Clean-CSS 5.0
Actual error stack:
Client CSS build error TypeError: Cannot read property 'bind' of undefined
at overrideProperties (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/properties/override-properties.js:468:53)
at optimizeProperties (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/properties/optimize.js:33:5)
at reduceSelector (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/reduce-non-adjacent.js:161:3)
at reduceSimpleNonAdjacentCases (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/reduce-non-adjacent.js:82:5)
at reduceNonAdjacent (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/reduce-non-adjacent.js:54:3)
at level2Optimize (/home/vlado/dev/pigallery/node_modules/clean-css/lib/optimizer/level-2/optimize.js:89:5)
at optimize (/home/vlado/dev/pigallery/node_modules/clean-css/lib/clean.js:221:5)
at /home/vlado/dev/pigallery/node_modules/clean-css/lib/clean.js:194:29
at /home/vlado/dev/pigallery/node_modules/clean-css/lib/reader/read-sources.js:26:64
at loadOriginalSources (/home/vlado/dev/pigallery/node_modules/clean-css/lib/reader/load-original-sources.js:26:5)
Code where this happens is in clean-css/lib/optimizer/level-2/properties/override-properties.js
mayOverride = configuration[right.name].canOverride;
overridable = everyValuesPair(mayOverride.bind(null, validator), left, right);
I’ve added a debug output just to check values:
console.log('clean-css debug:', right.name, configuration[right.name], configuration[right.name].canOverride);
And for most entries it passes without errors.
However, for right.name === clip
, there are no defaults and property canOverride
is not defined.
clean-css debug: clip {
valueOptimizers: [
[Function: whitespace],
[Function: fraction],
[Function: precision],
[Function: unit],
[Function: zero]
]
} undefined
Configuration is:
clean = new CleanCSS({ level: { 1: { all: true }, 2: { all: true } } });
And actual CSS is at: https://github.com/vladmandic/pigallery/blob/master/client/pigallery.css
I’ve added a quick workaround with, but that’s not a solution:
overridable = mayOverride ? everyValuesPair(mayOverride.bind(null, validator), left, right) : true;
Environment
- Clean-CSS 5.0
- NodeJS 15.7.0
- OS: Ubuntu 20.10
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Cannot read property 'bind' of undefined in latest Clean-CSS ...
Runtime error : Cannot read property 'bind' of undefined in latest Clean-CSS 5.0 Actual error stack: Client CSS build error TypeError: Cannot ...
Read more >Cannot read property 'bind' of undefined, React.js
In order to be able to bind addTimes to this in the constructor, addTimes must be a method on your class, not just...
Read more >TypeError: Cannot read property 'bind' of undefined - Reddit
TypeError : Cannot read property 'bind' of undefined ... handleChange.bind(this); ... I'm new to React so apologies!
Read more >cannot read properties of undefined (reading 'context')
So, it takes the value of clickedImg.id on the first render - which is undefined , because strings don't have such properties. As...
Read more >Changelog | Meteor API Docs
Summary of breaking changes. As Node.js version was upgraded to a new major version we recommend that you review if your npm dependencies...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
confirmed as resolved - thanks!
Thanks @vladmandic - the fix is ready. It was only possible to see it once files were combined, but actually the reduced test case was very very short. Going to release 5.0.1 shortly.