Comments (21)
If the patch is not merged today, I will fix the version in postcss-calc until it's merged/released.
from reduce-css-calc.
Yeah. The exception happens when I'm running a task that doesn't involve postcss at all, so it's very confusing. I'm still working on a replication case; I've confirmed on two machines that 1.2.4 works and 1.2.5 throws the exception.
from reduce-css-calc.
we have similar errors with our gulp tasks, it seems to be related to the polyfill, like @TheSpyder already mentioned:
[10:54:14] TypeError: Cannot read property 'length' of undefined
at flattenGlob (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/glob2base/index.js:9:25)
at setToBase (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/glob2base/index.js:48:12)
at module.exports (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/glob2base/index.js:56:19)
at Object.gs.createStream (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/glob-stream/index.js:34:42)
at Object.gs.create (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/glob-stream/index.js:68:42)
at Gulp.src (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/vinyl-fs/lib/src/index.js:33:23)
at module.exports (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/ecc-gulp-tasks/tasks/licenses-yaml2json.js:10:10)
at module.exports (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/leipert/eccenca/user-interface/apps/datamanager/node_modules/orchestrator/index.js:214:10)
from reduce-css-calc.
Please provides more informations. It seems you are using postcss-calc so postcss. So your config might help to track down this issue.
from reduce-css-calc.
Btw, your stack trace does not contains postcss or reduce-css-calc...
from reduce-css-calc.
OK it seems to only happen with multi tasks. I was using jshint but I made a custom one and I can still reproduce it.
I reduced it as far as removing the postcss configuration; all you have to do is require postcss-calc
somewhere in the file and then calls to grunt.config()
(which is trying to read the config) break.
Gruntfile (just tested in an empty directory):
module.exports = function(grunt) {
grunt.option('stack', true);
grunt.registerMultiTask('anything', 'any task will do', function () {
var myconfig = grunt.config([this.name, this.target]);
});
require('postcss-calc');
grunt.initConfig({
anything: {
literally: ['anything']
}
});
};
Then run:
npm install postcss-calc grunt
grunt anything
from reduce-css-calc.
hmm, I looked at your change and the only thing it really did was pull in that math project, so on a hunch I commented out the var mexp = require("math-expression-evaluator")
line. That stops throwing the error.
from reduce-css-calc.
Found it - the bug is in the Array.indexOf
polyfill. Want me to log it? I don't really have time to create a PR though (I suspect both the implementation is wrong and the check for whether the polyfill is needed).
from reduce-css-calc.
What version of node are you using?
from reduce-css-calc.
I'm on version 6, our build server is version 5.
from reduce-css-calc.
From what I understand it's more a bug that should be reported in "math-expression-evaluator" right?
from reduce-css-calc.
poke @ankit31894
from reduce-css-calc.
Maybe this snippet is the culprit https://github.com/redhivesoftware/math-expression-evaluator/blob/d6a82d8225232bbcb33246dc2337ca3a524adc99/src/postfix.js#L3-L11
from reduce-css-calc.
The test should be "Array.prototype.indexOf"?
Can you confirm this change is good for you @TheSpyder @leipert ?
from reduce-css-calc.
It's more than that - the implementation is wrong too. I found time to do a PR, just coding up a test now.
from reduce-css-calc.
Thank you!
from reduce-css-calc.
@MoOx we use gulp-cssnano
and rimraf
in our project. in gulp task get errors:
TypeError: Cannot read property 'length' of undefined
at Function.glob.hasMagic (/Users/luxiangyu/Jenkins/jobs/wingBuild/egretwing-electron/node_modules/rimraf/node_modules/glob/glob.js:106:29)
at rimraf (/Users/luxiangyu/Jenkins/jobs/wingBuild/egretwing-electron/node_modules/rimraf/rimraf.js:61:36)
at rimraf (/Users/luxiangyu/Jenkins/jobs/wingBuild/egretwing-electron/build/lib/util.js:253:3)
gulp-cssnano
indirect references to reduce-css-calc
, so we can't solve this problem. Can you remove math-expression-evaluator
first ? Thank you.
from reduce-css-calc.
Same problem here, can we revert deps math-expression-evaluator
for a hotfix?
from reduce-css-calc.
No need for ask for this in multiple places.
security issue > bug
aebe8f7#commitcomment-18721775
from reduce-css-calc.
If you guys can try this bugwheels94/math-expression-evaluator#2 (comment) and if that's ok, I can add this into reduce-css-calc as a workaround until the "official" fix gets merged/released.
from reduce-css-calc.
Upstream has been fixed, deleting node_modules
and reinstalling works for me.
from reduce-css-calc.
Related Issues (20)
- Strange unit math in 2.x HOT 2
- A percent is a not a unit of measure HOT 1
- -calc(...) gives calc() result HOT 9
- Negating values broken in 2.X HOT 6
- Error when building
- Constant values not supported HOT 16
- Standards or not? HOT 1
- Incorrect reduction of nested expression
- `NaN` value when reducing division with custom property
- Incorrect result for a specific case HOT 1
- constant + calc
- Complex calc function simplifying incorrectly HOT 1
- calc(...)rem adds space between number and unit HOT 1
- Plugin is removing comments and it shouldn't do it HOT 2
- Cannot handle nested calc()? HOT 3
- Parse error on custom property fallback HOT 1
- Precision for nested calc is not accurate
- Incorrect calculation when subtracting HOT 2
- Evaluation of mis-matching units HOT 1
- error PX
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reduce-css-calc.