Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

node.js - NodeJs grunt [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated

I have the following code for grunt file:

var fs = require('fs');
module.exports = function (grunt) {
    'use strict';
    grunt.initConfig({
        running: {
            taskOwner: 'ali',
            src: 'js/somefile.js',
            dest: 'somefile.js'
        },
        multi: {
            config1: {
                message: 'this is config1'
            },
            config2: {
                message: 'this is config2'
            }
        }
    });
    grunt.registerTask('running', 'An example task', function () {
        var done = this.async();
        grunt.config.requires('running.taskOwner');
        grunt.log.writeln(grunt.config.get('running.src'));
        grunt.log.writeln(grunt.config.get('running.dest'));
        fs.readFile(grunt.config.get('running.src'),function(error,data){
        fs.writeFile(grunt.config.get('running.dest'),data)
            done();
        });
    });
    grunt.registerMultiTask('multi', 'An example multi task', function () {
        grunt.log.writeln(this.data.message);
    });
    grunt.registerTask('run', 'run all tasks', ['running']);
};
 

I got this message and do not know why

[DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated. any one can help ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...