Skip to content
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

Custom registry must have get function #83

Closed
stefanstranger opened this issue May 18, 2018 · 2 comments
Closed

Custom registry must have get function #83

stefanstranger opened this issue May 18, 2018 · 2 comments

Comments

@stefanstranger
Copy link

In my Gulp build step I get the following error.

`
throw err;
^

AssertionError [ERR_ASSERTION]: Custom registry must have get function
at validateRegistry (C:\Users\john\Source\Repos\Contoso\ProductTasksExtension\node_modules\undertaker\lib\helpers\validateRegistry.js:28:5)
at Gulp.registry (C:\Users\john\Source\Repos\Contoso\ProductTasksExtension\node_modules\undertaker\lib\registry.js:17:3)
at Object. (C:\Users\john\Source\Repos\Contoso\ProductTasksExtension\gulpfile.js:10:6)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
`
How do I troubleshoot is error?

Thanks
Stefan

@phated
Copy link
Member

phated commented May 18, 2018

custom registries are a very advanced feature. You probably don't want to be using them.

@phated phated closed this as completed May 18, 2018
@ginnsquad
Copy link

ginnsquad commented Jul 16, 2018

@stefanstranger I ran into this error as well. I am not sure how your folder structure is setup but here is mine:

gulpfile.js
  |- gulp/
    |- default.js
    |- tasks/
      |- styles.js
      |- scripts.js
      |- clean.js

In my gulpfile.js, I have defined the HubRegistry as instructed on https://github.com/frankwallis/gulp-hub/.

var gulp        = require("gulp");
var HubRegistry = require("gulp-hub");

// Load main tasks in gulp/
var hub = new HubRegistry(["./gulp/default.js"]);

// Tell gulp to use the tasks just loaded
gulp.registry(hub);

Then in my default.js, I have

var HubRegistry = require("gulp-hub");

// Load all other gulp tasks in tasks/
var hub = new HubRegistry(["./tasks/*.js"]);

// Tell gulp to use the tasks just loaded
gulp.registry(hub);

The problem was how the Gulp tasks were being exposed in style.js or any other Gulp task file I was trying to load. At first I was using CommonJS like this and getting the same error as you:

exports.styles = styles;

So I changed those to Gulp tasks and it worked:

gulp.task("styles", styles);

FYI - I am using Gulp 4.0 so I had also installed the latest branch of gulp-hub so I'm not sure if that will make any difference. You can install it by running npm i --save-dev gulp-hub@frankwallis/gulp-hub#4.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants