DeprecationWarning: Calling an asynchronous function without callback is deprecated. - how to find where the "function:" is?

You can use either the --trace-deprecation or --throw-deprecation options.

For example:

node --trace-deprecation app.js

or:

node --throw-deprecation app.js

The first option will log a stack trace and the second will throw an error (which, if not caught, will also log a stack trace).

Also, 4346 is most likely the process ID.


You need to include a callback function for the Asynchronous method (writeFile in your case).

For example

var fs = require('fs');
fs.writeFile('writeMe.txt',data,'utf8',(error)=>{
    // your code goes here
});

where

(error) => { });

is the callback function.

From Version: v7.0.0
The callback parameter is no longer optional. Not passing it will emit a deprecation warning.

Please refer: https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback for more info.


I prefer the following two methods, myself.

1:

fs.writeFile('example.md', data, (error) => { console.log("Error!"); });

2:

fs.writeFile('example.md', data, function (err) {
    if(err){
        throw err;
    }
});