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

6to5-node breaks gulp watch #489

Closed
ivan-kleshnin opened this Issue Jan 14, 2015 · 18 comments

Comments

Projects
None yet
8 participants
@ivan-kleshnin

Disclaimer: I'm not quite sure it's a problem exactly with 6to5 and not gulp.

gulp watch task does not work with 6to5-node or vice-versa 6to5-node breaks gulp watch

I change shebang in /usr/local/lib/node_modules/gulp/bin/gulp.js file

#!/usr/bin/env node --> 
#!/usr/bin/env 6to5-node

Then I try to run any gulp watch task

gulp.task("watch", function() {
  // It does not matter what task is – every one I tried crashed.
  gulp.watch("./src/app_react/**/*.js", ["dist-react"]);
});

Then it crashes in byzantine way

TypeError: boolean is not a function
    at Function.isPlainObject (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash/dist/lodash.js:1652:64)
    at Object.globule.find (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/lib/globule.js:64:19)
    at Gaze.add (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:174:19)
    at new Gaze (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)
    at gaze (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:86:10)
    at Object.module.exports [as watch] (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/index.js:12:17)
    at Gulp.watch (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/index.js:35:16)
    at Gulp.<anonymous> (/Users/ivankleshnin/JavaScript/twitto/gulpfile.js:78:8)
    at module.exports (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/ivankleshnin/JavaScript/twitto/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
Error running task sequence: { task: 'watch',
  message: 'watch catch',
  duration: 0.001110806,
  hrDuration: [ 0, 1110806 ],
  err: [TypeError: boolean is not a function] }

Other gulp things except gulp.watch seems to work ok.

If you think it's a Gulp problem – I'll repost it there.

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens Jan 14, 2015

Member

Looks like it's a result of gulp depending on vinyl-fs that depends on glob-watcher that uses an outdated version of gaze which uses an outdated version of globule that uses an oudated version of lodash that has a dodgy Object.getPrototypeOf check because core-js overrides it.

One possible fix (and I have no idea if this will work) is to add lodash to your dependencies via npm install --save lodash and then reinstall all of your node_modules.

Member

kittens commented Jan 14, 2015

Looks like it's a result of gulp depending on vinyl-fs that depends on glob-watcher that uses an outdated version of gaze which uses an outdated version of globule that uses an oudated version of lodash that has a dodgy Object.getPrototypeOf check because core-js overrides it.

One possible fix (and I have no idea if this will work) is to add lodash to your dependencies via npm install --save lodash and then reinstall all of your node_modules.

@ivan-kleshnin

This comment has been minimized.

Show comment
Hide comment
@ivan-kleshnin

ivan-kleshnin Jan 15, 2015

@sebmck is a genius 👽 . I installed latest lodash as project dependency and removed it from globule and it works now. I've submitted related issue to glob-watcher

@sebmck is a genius 👽 . I installed latest lodash as project dependency and removed it from globule and it works now. I've submitted related issue to glob-watcher

@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Feb 20, 2015

Member

of lodash that has a dodgy Object.getPrototypeOf check because core-js overrides it.

lodash correctly detects _.isNative(Object.getPrototypeOf) as false.
See http://jsbin.com/pugimomame/1/.

Member

jdalton commented Feb 20, 2015

of lodash that has a dodgy Object.getPrototypeOf check because core-js overrides it.

lodash correctly detects _.isNative(Object.getPrototypeOf) as false.
See http://jsbin.com/pugimomame/1/.

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens Feb 20, 2015

Member

@jdalton Yeah, I was referring to the version that was being loaded by globule. It was using 1.0.1 which has the following:

var isPlainObject = function(value) {
  if (!(value && typeof value == 'object')) {
    return false;
  }
  var valueOf = value.valueOf,
      objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);

  return objProto
    ? value == objProto || (getPrototypeOf(value) == objProto && !isArguments(value))
    : shimIsPlainObject(value);
};

It was calling getPrototypeOf which was set via:

getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf

getPrototypeOf however was false as Object.getPrototypeOf was shimmed via core-js and was failing the reNative test.

Member

kittens commented Feb 20, 2015

@jdalton Yeah, I was referring to the version that was being loaded by globule. It was using 1.0.1 which has the following:

var isPlainObject = function(value) {
  if (!(value && typeof value == 'object')) {
    return false;
  }
  var valueOf = value.valueOf,
      objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);

  return objProto
    ? value == objProto || (getPrototypeOf(value) == objProto && !isArguments(value))
    : shimIsPlainObject(value);
};

It was calling getPrototypeOf which was set via:

getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf

getPrototypeOf however was false as Object.getPrototypeOf was shimmed via core-js and was failing the reNative test.

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens Feb 20, 2015

Member

You can reproduce this with the following steps:

$ npm install gulp core-js
> require("core-js");
> require("gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash").isPlainObject([]);
Member

kittens commented Feb 20, 2015

You can reproduce this with the following steps:

$ npm install gulp core-js
> require("core-js");
> require("gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash").isPlainObject([]);
@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Feb 20, 2015

Member

Ah nice, so just an old bug. Thank you for digging.

Member

jdalton commented Feb 20, 2015

Ah nice, so just an old bug. Thank you for digging.

@gsklee

This comment has been minimized.

Show comment
Hide comment
@gsklee

gsklee Feb 20, 2015

I'm not sure if this is an old bug because I'm getting this in the latest versions of things (babel@4.0.2, gulp@3.8.11), or there might be a regression of sorts.

gsklee commented Feb 20, 2015

I'm not sure if this is an old bug because I'm getting this in the latest versions of things (babel@4.0.2, gulp@3.8.11), or there might be a regression of sorts.

@kittens

This comment has been minimized.

Show comment
Hide comment
@kittens

kittens Feb 20, 2015

Member

It's an old bug in lodash, see my comment here. It's the result of a chain of outdated dependencies.

Member

kittens commented Feb 20, 2015

It's an old bug in lodash, see my comment here. It's the result of a chain of outdated dependencies.

@gsklee

This comment has been minimized.

Show comment
Hide comment
@gsklee

gsklee Feb 20, 2015

@sebmck So if I'm getting this right, I'll need to ask glob-watcher to use a newer version of gaze?

gsklee commented Feb 20, 2015

@sebmck So if I'm getting this right, I'll need to ask glob-watcher to use a newer version of gaze?

@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Feb 20, 2015

Member

It's an old bug in lodash,

Yap a bug in lodash 1.0.1 (2 years old)

Member

jdalton commented Feb 20, 2015

It's an old bug in lodash,

Yap a bug in lodash 1.0.1 (2 years old)

@qrohlf

This comment has been minimized.

Show comment
Hide comment
@qrohlf

qrohlf Feb 25, 2015

So to clarify for others who are running into this, the workaround is to npm install -S loadash to grab the latest lodash as a project dependency, then edit

node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule

to remove the "lodash": "~1.0.1", dependency, then remove

node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash

then things should work...

enough-internet

qrohlf commented Feb 25, 2015

So to clarify for others who are running into this, the workaround is to npm install -S loadash to grab the latest lodash as a project dependency, then edit

node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule

to remove the "lodash": "~1.0.1", dependency, then remove

node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash

then things should work...

enough-internet

@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Feb 25, 2015

Member

Naw, until vinyl-fs bumps you can reference it's package via its commit hash.
Hmm ah ya, because of gulp hmm \cc @contra

Member

jdalton commented Feb 25, 2015

Naw, until vinyl-fs bumps you can reference it's package via its commit hash.
Hmm ah ya, because of gulp hmm \cc @contra

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Feb 25, 2015

Yeah we haven't published the 4.0 version of vinyl-fs yet because we have a few breaking PRs we want to land first. Shouldn't be long though, until then just use the master branch or something in your package

contra commented Feb 25, 2015

Yeah we haven't published the 4.0 version of vinyl-fs yet because we have a few breaking PRs we want to land first. Shouldn't be long though, until then just use the master branch or something in your package

@AgentME

This comment has been minimized.

Show comment
Hide comment
@AgentME

AgentME Mar 24, 2015

Contributor

I came up with a work-around that doesn't require everyone using a project to mess with their node_modules folder:

require('babel/register');
Object.getPrototypeOf.toString = function() {return Object.toString();};

glob-watcher isn't updating their gaze dependency, so it seems like one of the following has to happen to get this properly fixed:

  • globule backports the lodash dependency update and releases a version 0.1.1.
  • gaze backports the globule dependency update and releases a version 0.5.2.
  • lodash backports the getPrototypeOf fix and releases a version 1.0.2.
  • babel changes its polyfill to make its Object.getPrototypeOf replacement look native to work around the ancient lodash issue.
Contributor

AgentME commented Mar 24, 2015

I came up with a work-around that doesn't require everyone using a project to mess with their node_modules folder:

require('babel/register');
Object.getPrototypeOf.toString = function() {return Object.toString();};

glob-watcher isn't updating their gaze dependency, so it seems like one of the following has to happen to get this properly fixed:

  • globule backports the lodash dependency update and releases a version 0.1.1.
  • gaze backports the globule dependency update and releases a version 0.5.2.
  • lodash backports the getPrototypeOf fix and releases a version 1.0.2.
  • babel changes its polyfill to make its Object.getPrototypeOf replacement look native to work around the ancient lodash issue.
@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Mar 24, 2015

Member

lodash backports the getPrototypeOf fix and releases a version 1.0.2.

I can do that.

Member

jdalton commented Mar 24, 2015

lodash backports the getPrototypeOf fix and releases a version 1.0.2.

I can do that.

@AgentME

This comment has been minimized.

Show comment
Hide comment
@AgentME

AgentME Mar 24, 2015

Contributor

@jdalton That'd be perfect, thanks.

Contributor

AgentME commented Mar 24, 2015

@jdalton That'd be perfect, thanks.

@jdalton

This comment has been minimized.

Show comment
Hide comment
@jdalton

jdalton Mar 30, 2015

Member

Published a fix lodash@1.0.2.

Member

jdalton commented Mar 30, 2015

Published a fix lodash@1.0.2.

@gsklee

This comment has been minimized.

Show comment
Hide comment

gsklee commented Mar 31, 2015

@jdalton 👍

@lock lock bot added the outdated label Jul 23, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Jul 23, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.