Skip to content

Callback required in Node v10+ #20

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

Closed
nwittwer opened this issue Aug 10, 2018 · 1 comment
Closed

Callback required in Node v10+ #20

nwittwer opened this issue Aug 10, 2018 · 1 comment

Comments

@nwittwer
Copy link

Hi, I'm running into an issue which looks like it's coming from using Node v10+:

Based on the search docs, I tried this in my Gulp file:

function docs() {
  return gulp.src('docs/**/*.md')
  .pipe( Super.init() )
    .on('finish', function() {
        Super.buildSearch('docs/sitemap.json');
    })
  .pipe(gulp.dest('dist'))
}

However, I get this error:

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:133:9)
    at Object.writeFile (fs.js:1132:14)
    at /Users/dev/UI-design-workspace/node_modules/supercollider/lib/buildSearch.js:62:8
    at /Users/dev/UI-design-workspace/node_modules/supercollider/node_modules/mkdirp/index.js:48:26
    at FSReqWrap.oncomplete (fs.js:159:5)

Version info:
Supercollider: ^1.4.4
Gulp: 4.0
Node: 10.6.0

Maybe an update is need for this library to support Node v10+? It looks like the callback() is no longer optional for the Super.buildSearch() function, since Node v10.0. (Open the History panel)


I played around with a few hotfixes:

1.) Changing the fs.writeFile to fs.writeFileSync. I don't think this is a good long-term solution, as it changes from async to synchronous file writing.

File: buildSearch.js, line 62
Current: fs.writeFile(outFile, JSON.stringify(results, null, ' '), cb);
Hotfix: fs.writeFile(outFile, JSON.stringify(results, null, ' '), cb);

2.) Adding an empty callback function in the Gulp task.

function docs() {
  return gulp.src('docs/**/*.md')
  .pipe( Super.init() )
    .on('finish', function() {
        Super.buildSearch( 'docs/sitemap.json', function(){} ); // <---- empty callback function
    })
  .pipe(gulp.dest('dist'))
}

P.S. Supercollider is still awesome. But I may be biased ;)

@nwittwer nwittwer changed the title Callback required by Node FS Callback required in Node v10+ Aug 10, 2018
@kball
Copy link
Contributor

kball commented Jul 26, 2019

I believe issues with node 10 and 12 have been resolved in #22. Tests work, and foundation can build.

@kball kball closed this as completed Jul 26, 2019
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

2 participants