Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 找不到正在执行的任务_Javascript_Node.js_Gruntjs_Grunt Cli - Fatal编程技术网

Javascript 找不到正在执行的任务

Javascript 找不到正在执行的任务,javascript,node.js,gruntjs,grunt-cli,Javascript,Node.js,Gruntjs,Grunt Cli,我被这个难住了。我通过CLI和WebStorm使用Grunt已有一段时间了。今天我通过WebStorm Grunt面板运行了一些手动Grunt任务,奇迹般地发生了一件事,我再也不能在这个项目上运行任何任务了(既不能通过WebStorm也不能通过命令行)。我尝试了一切,从重新安装grunt/grunt cli,重新启动我的电脑,缩写grunt文件都没有用。下面是一个带有问题输出的超级缩写Gruntfile.js。对于可能发生的事情以及如何恢复我的构建环境的任何想法,我们都非常感谢 Carlos@X

我被这个难住了。我通过CLI和WebStorm使用Grunt已有一段时间了。今天我通过WebStorm Grunt面板运行了一些手动Grunt任务,奇迹般地发生了一件事,我再也不能在这个项目上运行任何任务了(既不能通过WebStorm也不能通过命令行)。我尝试了一切,从重新安装grunt/grunt cli,重新启动我的电脑,缩写grunt文件都没有用。下面是一个带有问题输出的超级缩写Gruntfile.js。对于可能发生的事情以及如何恢复我的构建环境的任何想法,我们都非常感谢

Carlos@XPS8500 ~/git/Test
$ cat Gruntfile.js
'use strict';

module.exports = function (grunt) {
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        cwd: '.',
                        src: 'package.json',
                        dest: 'package.xxx'
                    }
                ]
            }
        }
    });

    grunt.registerTask('test', 'Test', function(){

        grunt.task.run('copy:dist');

    });
};

Carlos@XPS8500 ~/git/Test
$ grunt --verbose test
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ test

Running tasks: test

Running "test" task
Warning: Task "copy:dist" not found. Use --force to continue.

Aborted due to warnings.

Carlos@XPS8500 ~/git/Test

该死,package.json被覆盖,因此所有的grunt包都丢失了。事后看来,我想这个错误消息是有道理的。顺便说一句,当package.json中的json无效时,我也看到了这一点(例如,像一个额外的逗号)。