Giter Club home page Giter Club logo

Comments (21)

MoOx avatar MoOx commented on August 14, 2024 3

If the patch is not merged today, I will fix the version in postcss-calc until it's merged/released.

from reduce-css-calc.

TheSpyder avatar TheSpyder commented on August 14, 2024 1

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.

leipert avatar leipert commented on August 14, 2024 1

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.

MoOx avatar MoOx commented on August 14, 2024

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.

MoOx avatar MoOx commented on August 14, 2024

Btw, your stack trace does not contains postcss or reduce-css-calc...

from reduce-css-calc.

TheSpyder avatar TheSpyder commented on August 14, 2024

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.

TheSpyder avatar TheSpyder commented on August 14, 2024

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.

TheSpyder avatar TheSpyder commented on August 14, 2024

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.

MoOx avatar MoOx commented on August 14, 2024

What version of node are you using?

from reduce-css-calc.

TheSpyder avatar TheSpyder commented on August 14, 2024

I'm on version 6, our build server is version 5.

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

From what I understand it's more a bug that should be reported in "math-expression-evaluator" right?

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

poke @ankit31894

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

Maybe this snippet is the culprit https://github.com/redhivesoftware/math-expression-evaluator/blob/d6a82d8225232bbcb33246dc2337ca3a524adc99/src/postfix.js#L3-L11

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

The test should be "Array.prototype.indexOf"?
Can you confirm this change is good for you @TheSpyder @leipert ?

from reduce-css-calc.

TheSpyder avatar TheSpyder commented on August 14, 2024

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.

MoOx avatar MoOx commented on August 14, 2024

Thank you!

from reduce-css-calc.

f111fei avatar f111fei commented on August 14, 2024

@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.

fengmk2 avatar fengmk2 commented on August 14, 2024

Same problem here, can we revert deps math-expression-evaluator for a hotfix?

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

No need for ask for this in multiple places.
security issue > bug
aebe8f7#commitcomment-18721775

from reduce-css-calc.

MoOx avatar MoOx commented on August 14, 2024

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.

TheSpyder avatar TheSpyder commented on August 14, 2024

Upstream has been fixed, deleting node_modules and reinstalling works for me.

from reduce-css-calc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.