• Register
0 votes
176 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?

6 5 3
7,540 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 2.5K views
2.5K 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
0 votes
1 answer 1.7K views
1.7K 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
2 answers 432 views
432 views
Problem : I am new to Programming. I have created a Maven Project, the JavaScript project is cloned as the git sub-module inside Maven Project. My directory structure is as below mavenapp/src/main/javascript/[npm project files] and inside the package.json my test is looking as below : " ... install But it is not working for me.. npm version : 5.5.1 node version : 9.3.0 How can I fix above error?
asked Mar 3, 2020 mphil 2.3k points
0 votes
1 answer 1.7K views
1.7K views
Problem : I am beginner in the node.js .Currently I am trying to install node.js using the below command npm install nodemon --save. But when I try to run a server with below command nodemon server.js. then in my terminal I face below error: “Nodemon is not recognized as internal or external command, operable program or batch file”
asked Feb 13, 2020 mphil 2.3k points
0 votes
1 answer 107 views
0 votes
2 answers 3.2K views
3.2K views
Problem : Facing following express issue throw new typeerror('router.use() requires a middleware function but got a ' + gettype(fn))
asked Nov 18, 2019 peterlaw 6.9k points
1 vote
2 answers 333 views
333 views
Problem : Looking for solution on bellow npm error npm err! this is probably not a problem with npm. there is likely additional logging output above.
asked Nov 8, 2019 peterlaw 6.9k points
0 votes
1 answer 23 views
23 views
Problem: I am a beginner to node.js, cordova and npm.When I try below command: $ npm install -g cordova@latest I always face below error: “Npm WARN deprecated node-uuid@1.4.8: Use uuid module instead.” Below are my system details: mac Os Sierra 10.12 ... each and every suggestion and also tried to install or uninstall the hundred times. I want to know is it a npm or cordova problem?
asked Aug 29, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 542 views
542 views
Problem: I am very new to node so I think I am making something extremely wrong here as I am unable to find any info at all by doing research online. I already have the django site and I required the JS charting library so I chose the chart.js. I have ... build a chart. Failed to create chart: can't acquire context from the given item . Please help me in fixing above NodeJs elated error.
asked Jun 4, 2020 Martin K 6.6k points
1 vote
2 answers 692 views
692 views
Problem : I am very new to the Node.js and I am having few issues. I am using the Node.js 4.10 and Express 2.4.3. While trying to execute my code I am receiving below error : Error: Can't render headers after they are sent to the client. ... , scope: 'offline_access,email,user_about_me,user_activities,manage_pages,publish_stream', failedUri: '/noauth' }) ])); realapp.use(realapp.router); }); . . .
asked Dec 12, 2019 alecxe 7.5k points