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

fs.writeFile throws ERR_INVALID_CALLBACK #566

Open
koebeen opened this issue Jul 21, 2018 · 8 comments
Open

fs.writeFile throws ERR_INVALID_CALLBACK #566

koebeen opened this issue Jul 21, 2018 · 8 comments

Comments

@koebeen
Copy link

koebeen commented Jul 21, 2018

Versions of kyt, node, OS

kyt 0.9.0
node 10.6.0
OS macos 10.11.6

Bug or Feature?

Bug

Current Behavior

yarn dev or npm run dev results in an error

Desired Behavior

no error is thrown. app runs.

Fix:

line 72 of webpack.base.js shoud read:
fs.writeFileSync(assetsFilePath, JSON.stringify(assets, null, ' '), 'utf8');
instead of:
fs.writeFile(assetsFilePath, JSON.stringify(assets, null, ' '), 'utf8');

Full error:

fs.js:133
  throw new ERR_INVALID_CALLBACK();
  ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:133:9)
    at Object.writeFile (fs.js:1132:14)
    at WebpackAssetsManifest.done (/kyt/node_modules/kyt/config/webpack.base.js:72:16)
    at WebpackAssetsManifest.emit (events.js:182:13)
    at Compiler.applyPlugins (/kyt/node_modules/tapable/lib/Tapable.js:61:14)
    at /kyt/node_modules/webpack/lib/Compiler.js:273:13
    at Compiler.emitRecords (/kyt/node_modules/webpack/lib/Compiler.js:369:37)
    at /kyt/node_modules/webpack/lib/Compiler.js:267:12
    at /kyt/node_modules/webpack/lib/Compiler.js:362:11
    at next (/kyt/node_modules/tapable/lib/Tapable.js:218:11)
@awayken
Copy link
Contributor

awayken commented Oct 2, 2018

@koebeen I've been running into this, too. I had to ensure that I was running on Node 8 (which is the LTS right now). I hope this helps!

@stmathew7
Copy link

Yep, using Node 8 resolved the same error for me as well.

@koebeen
Copy link
Author

koebeen commented Oct 27, 2018

thanks guys. yeah, obvious in the end. i should have run the lts..

@fesebuv
Copy link
Contributor

fesebuv commented Nov 29, 2018

@koebeen @awayken
Is this issue resolved? Could it be closed?
Thanks.

@stmathew7
Copy link

stmathew7 commented Nov 29, 2018 via email

@jackgray
Copy link

Is Node v8 required to use kyt? I'm getting invalid callback error when following getting started instructions verbatim. If this is the case, it seems that either updating kyt to work with Node 10 or mentioning in the ReadMe that Node 8 is required would be appropriate, as Node 10.x is listed as the current LTS version.

@DataRogue
Copy link

Node v10 is now LTS, when can we expect a solution for this?

@kierandesmond
Copy link

What worked for me, was editing webpack-version-file-plugin > index

VersionFile.prototype.writeFile = function(templateContent){ var self = this; fileContent = ejs.render(templateContent, self.options); fs.writeFile(self.options.outputFile, fileContent, {flag: 'w'}, function() {}); }

Note after the flag options, I just added a blank callback function. Then the build continued unhindered. Hope this helps someone.

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

7 participants