• Register
0 votes
244 views

Problem :

I have recently updated the node to 7.2.1 and noticed that there is the warning coming as below :

(node:4346) DeprecationWarning: Calling an asynchronous function without callback is deprecated.

Why is this 4346 ? I only have 2000 lines of code in the js file, so it must not be the line-number. Where should I look for that code?

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had also got the same warning

[DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated. 

I saw this statement-suspect:

Fs . writeFile (path, aString, cb, encoding);

So the problem was the cb (= 'callback') and the encoding arguments are in the wrong order. So I got rid of the warning simply by changing the above to below:

Fs . writeFile (path, aString, encoding,  cb);

But the problem is really with the ERRONEOUS warning-message So if the warning had informed as below

"WWARNING: calling fs.writeFile() with a string-argument 
where a function is expected"

So the point here was I was NOT calling the writeFile() without the callback-argument, which is shown as deprecated. I was trying to call the writeFile() WITH A WRONG TYPE OF ARGUMENT. So that must be an ERROR and not the warning.

I hope it solved your issue.

38.6k points

Related questions

0 votes
1 answer 5 views
5 views
Problem: Where should I look for a solution : Calling an asynchronous function without callback is deprecated?
asked Jun 20 Florina Gulnar 106k points
0 votes
1 answer 8 views
8 views
Problem : Is there a method to resolve this issue: Calling an asynchronous function without callback is deprecated?
asked Jun 21 Siam55 110k points
0 votes
1 answer 32 views
32 views
Problem: Can anyone tell me the solution of this problem? the great promise of exporting is that:
asked Mar 24 Ifra 43.4k points
0 votes
1 answer 35 views
35 views
Problem: Where is this error coming from? I am not using ensureIndex or createIndex in my Nodejs application anywhere. I am using yarn package manager. Here is my code in index.js import express from 'express'; import path from 'path'; import bodyParser from ' ... ; mongoose.Promise = Promise; mongoose.connect('mongodb://localhost:27017/bookworm', { useNewUrlParser: true }); const app = express();
asked Apr 26 sumaiya simi 43.9k points
0 votes
1 answer 37 views
37 views
Problem: Any help, I will be so thankful: Deprecationwarning: collection.ensureindex is deprecated. use createindexes instead.
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 2.4k views
2.4k views
Problem : I am getting following error: Deprecationwarning: collection.ensureindex is deprecated. use createindexes instead. Where is above error coming from? I am not at all using ensureIndex or createIndex in my Nodejs application anywhere. I am using the yarn package manager. ... ', { useNewUrlParser: true }); const myapp = express(); Does anyone ever faced this issue? Any solution on it?
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 14 views
14 views
Problem: Where should I look for help with this issue? >Deprecationwarning: collection#find: pass a function instead.
asked May 8 Rada Gracelynn 104k points
0 votes
1 answer 13 views
13 views
Problem: Error: route.post() requires a callback function but got a [object undefined].
asked Jul 3 Florina Gulnar 106k points
0 votes
1 answer 97 views
97 views
Problem: HELP me to deal with this : Error: route.get() requires a callback function but got a [object undefined].
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 4.8k views
4.8k views
Problem : I am just starting coding using the nodejs with express. So I simply did this in my file test.js which is into my folder routes : const myexpress = require('express'); const myrouter = new myexpress.Router(); myrouter.get('/test', (req, res) => { res.send(` ... browser, it tells me it Cannot get/test I don't understand why this is happening to me. Please let me know how can I fix this?
asked Jan 23, 2020 jwilliam 3.9k points