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

Solve "[DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated." #57

Open
GoooodSky opened this issue Apr 24, 2018 · 8 comments

Comments

@GoooodSky
Copy link

GoooodSky commented Apr 24, 2018

Here is a contemporary solution from @BenjaminChoou:

1. Find where your node-tesseract module is.

On my computer, the path is :

C:\Users\BenjaminChou\node_modules\node-tesseract\lib

2. Open and modify tesseract.js as follow:

Before:
fs.unlink(files[0]);
Now:
fs.unlink(files[0], err => { if (err) console.log(err) });

@JesseWo
Copy link

JesseWo commented May 6, 2018

Thanks!

@ceremcem
Copy link

@uchihaty Why don't you create a PR for this?

@jonathonadams
Copy link

Is this project sill active? Just an FYI, I'm testing with Node v10 and this error now breaks the project.

Error message:

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:148:11)
at Object.fs.unlink (fs.js:1016:14)
at /.../node_modules/node-tesseract/lib/tesseract.js:99:14
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:422:3)
[ERROR] 13:14:21 TypeError [ERR_INVALID_CALLBACK]

@Lucien-X
Copy link

Same issue Encountered,
node version v11.0.0

@liuwei0514
Copy link

Same issue Encountered,
node version v10.9.0

@halaprop
Copy link

halaprop commented Jul 30, 2019

Same issue. Probably, the fix should include calling the caller's callback after the unlink...

fs.unlink(files[0], err => { err ? callback(err, null) : callback(null, data); });

@ceremcem
Copy link

@halaprop I think something is wrong with your suggestion: Where is the callback and data defined?

@halaprop
Copy link

@ceremcem - Sorry, I should have been more explicit. I was looking here, line 100 is where unlink is called. callback is passed to the containing function (process()), and data is the result of an fs.read which encloses this code.

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