-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
DeprecationWarning: Calling an asynchronous function without callback is deprecated. in fs.writeFile #14770
Comments
Hi, @pankaja92. The tutorial is a bit outdated (5 years old) in that fs.writeFile("text.txt", data); by this one: fs.writeFile("text.txt", data, (error) => { /* handle error */ }); see https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback |
@vsemozhetbyt but why use a callback when one can use async/await with try catch? |
@tommedema Node.js |
@vsemozhetbyt Thank you for this answer :) |
Starting in Node.js 10.0.0, there are experimental promise versions of the |
@vsemozhetbyt |
Can any one help me imagemin |
i also have the same problem heres my gulpfile code 'use strict'; var gulp = require('gulp'); // Static Server + watching scss/html files
}); // Compile sass into CSS & auto-inject into browsers gulp.task('js', function() { gulp.task('default', ['serve']); anyone can help me? |
If you encounter a deprecation warning but do not know what code causes it (usually because it's code in your dependency), you can use the |
Version: v8.0.0
Platform: Linux pankaja-HP-Pavilion-15-Notebook-PC 4.10.0-30-generic #34~16.04.1-Ubuntu SMP Wed Aug 2 02:13:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Subsystem: fs.writeFile
Error : (node:10801) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
Code :
I was following this tutorial and when Reading and Writing files I'm getting this error. When I use
node --trace-deprecation file.js
I'm getting this log message.Is this a bug ?
The text was updated successfully, but these errors were encountered: