lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 75 forks source link

Unhandled rejection TypeError: Cannot read property 'apply' of undefined #312

Closed BobbyBabes closed 5 years ago

BobbyBabes commented 5 years ago
[bobbybabes@ladyluck 4.4.23 ~]# echo -e '\n'; node -v; echo -e '\n\n'; npm -v; echo -e '\n\n'; bash --version; echo -e '\n\n';uname --all; echo -e '\n';

v10.8.0

6.3.0

GNU bash, version 4.4.23(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Linux ladyluck 4.17.11-arch1 #1 SMP PREEMPT Sun Jul 29 10:11:16 UTC 2018 x86_64 GNU/Linux

I've only just discovered Taskr and I'm running into this issue.

My test code dies on line 16 of Bluebird's util.js : return target.apply(this, arguments);. Where target is undefined.

const Taskr = require('taskr');

const src = './builder', dest = './dist';

const init = async (t, o) => {
  await t.$.log(`t.$.log : init.t === ${t}`);
  await t.$.log(`t.$.log : init.o === ${o}`);
  await t.clear(dest, {disableGlob: true});
  await console.log('console.dir : init.t ==='); console.dir(t);
  await console.log('console.dir : init.o ==='); console.dir(o);
}

const bar = async (t) => {
  await console.log('console.dir : bar.t ==='); console.dir(t/*, {showHidden: true, depth: null, colors: true}*/);
}

const goGoGo = async (t) => {
  await t.serial(['init', 'bar']);
  // await t.start('bar');
  // await t.start('init');
  await console.log('console.dir : default.t ==='); console.dir(t);
}

const taskr = new Taskr({
  tasks: {
    init: init,
    bar: bar,
    default: goGoGo
  },
  plugins: [
    require('@taskr/clear'),
  ]
});

taskr.start();

The code snippet is in this Runkit Notebook : https://runkit.com/bobbybabes/taskr-bluebird-error-2

Task {$: Object, root: "/home/bobbybabes/dev/web/web-ui-toolkit-builder-ta…", _: Object, parallel: , serial: , …}
test2-taskr.js:21
Unhandled rejection TypeError: Cannot read property 'apply' of undefined
    at Promise.tryCatcher (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/generators.js:97:49)
    at Task.<anonymous> (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/generators.js:201:15)
    at Task.exec (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/taskr/lib/task.js:38:12)
    at Task.<anonymous> (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/taskr/lib/boot.js:26:15)
    at Taskr.start (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/taskr/lib/taskr.js:105:37)
    at start.next (<anonymous>)
    at start.tryCatcher (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseFulfilled (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/generators.js:97:49)
    at Taskr.<anonymous> (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/node_modules/bluebird/js/release/generators.js:201:15)
    at Object.<anonymous> (/home/bobbybabes/dev/web/web-ui-toolkit-builder-taskr/test2-taskr.js:35:7)
    at Module._compile (internal/modules/cjs/loader.js:686:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)