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

TypeError: "Callback must be a function" #79

Open
CodeWithOz opened this issue Sep 9, 2018 · 0 comments
Open

TypeError: "Callback must be a function" #79

CodeWithOz opened this issue Sep 9, 2018 · 0 comments

Comments

@CodeWithOz
Copy link

CodeWithOz commented Sep 9, 2018

node version: 10.6.0

This error caused my scripts to always exit even before the tests could start being checked.
This was the stack trace:

[11:29:44] Starting 'tests'...
[11:29:44] Running Jasmine with PhantomJS
[11:29:46] 'tests' errored after 2.42 s
[11:29:46] TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at makeCallback (fs.js:141:11)
    at Object.unlink (fs.js:912:14)
    at cleanup (C:\Users\ucheo\Projects\NDBuildTools\Lesson 3\node_modules\gulp-jasmine-phantom\index.js:45:6)
    at C:\Users\ucheo\Projects\NDBuildTools\Lesson 3\node_modules\gulp-jasmine-phantom\index.js:87:7
    at ChildProcess.exithandler (child_process.js:298:5)
    at ChildProcess.emit (events.js:182:13)
    at ChildProcess.EventEmitter.emit (domain.js:460:23)
    at maybeClose (internal/child_process.js:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

My Current (and Proposed) Solution
I found a similar issue in the Grunt version of this plugin and implemented the solution given there. In other words, I used the stack trace to locate the erroneous call to the unlink method in the cleanup function's definition and replaced fs.unlink(path) with fs.unlinkSync(path). I did not test this fix in other versions of node because the OP said he performed those tests and they worked; he also noted that the
unlinkSync method has been around since v0.1.21 so I expect that this will not be a breaking change.

lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-brief-responses-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-briefs-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-supplier-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-buyer-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-user-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-briefs-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-brief-responses-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-buyer-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-supplier-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch ldeb-upgrade-node-8-to-10
# Your branch is up to date with 'origin/ldeb-upgrade-node-8-to-10'.
#
# Changes to be committed:
#	modified:   package.json
#	modified:   yarn.lock
#
lfdebrux added a commit to Crown-Commercial-Service/digitalmarketplace-user-frontend that referenced this issue Sep 3, 2019
A bug in gulp-jasmine-phantom prevents it from working with NodeJS 10
[1]. Unfortunately, the bugfix never got merged (gulp-jasmine-phantom
hasn't been updated since 2016), so I've instead changed the JS
dependencies to use an alphagov fork of gulp-jasmine-phantom with the
fix applied [2].

[1]: dflynn15/gulp-jasmine-phantom#79
[2]: https://github.com/alphagov/gulp-jasmine-phantom/tree/node-10-fs-unlink
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

1 participant