Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.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/4/jquery-ui/2.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
Node.js Grunt执行多次,创建无限循环_Node.js_Gruntjs_Npm - Fatal编程技术网

Node.js Grunt执行多次,创建无限循环

Node.js Grunt执行多次,创建无限循环,node.js,gruntjs,npm,Node.js,Gruntjs,Npm,我们正在与GIT上的几个其他开发人员一起进行一个项目,使用相同的回购协议,其他人都可以使用。然而,当我运行grunt时,它会执行多次,似乎运行到一个无限循环中,而我实际上没有做任何更改。这只会发生在另一台电脑上 我在考虑也许我需要安装其他东西。 我删除了node,npm,并用自制软件重新安装,我也在使用自制软件进行更新。节点v5.3.0,npm 3.3.12 跑小牛队 我错过了什么 以下是循环: Reloading watch config... Running "watch" tas

我们正在与GIT上的几个其他开发人员一起进行一个项目,使用相同的回购协议,其他人都可以使用。然而,当我运行grunt时,它会执行多次,似乎运行到一个无限循环中,而我实际上没有做任何更改。这只会发生在另一台电脑上 我在考虑也许我需要安装其他东西。 我删除了node,npm,并用自制软件重新安装,我也在使用自制软件进行更新。节点v5.3.0,npm 3.3.12 跑小牛队

我错过了什么

以下是循环:

    Reloading watch config...

Running "watch" task
Waiting...
>> File "Gruntfile.js" changed.
>> File "js/all-js/bootstrap-hover-dropdown.min.js" changed.
>> File "js/all-js/site.js" changed.
Running "uglify:build" (uglify) task
>> 1 file created.

Done, without errors.
Completed in 3.740s at Tue Jan 05 2016 13:11:07 GMT-0500 (ECT) - Waiting...
[BS] File changed: js/site.min.js

Reloading watch config...

Running "watch" task
Waiting...
>> File "js/all-js/bootstrap.js" changed.
>> File "Gruntfile.js" changed.
Running "uglify:build" (uglify) task
>> 1 file created.

Done, without errors.
Completed in 1.869s at Tue Jan 05 2016 13:11:10 GMT-0500 (ECT) - Waiting...
[BS] File changed: js/site.min.js
>> File "js/all-js/bootstrap-hover-dropdown.min.js" changed.
Running "uglify:build" (uglify) task
>> 1 file created.

Done, without errors.
Completed in 1.885s at Tue Jan 05 2016 13:12:04 GMT-0500 (ECT) - Waiting...
[BS] File changed: js/site.min.js

Reloading watch config...

Running "watch" task
Waiting...
>> File "Gruntfile.js" changed.
这是我的Grunfile.js:

    module.exports = function(grunt) {

//Get all tasks from the package.json file
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);

grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),    

    /* Concurrent Task */          

    concurrent: {
        watch: {
            tasks: ['watch', 'compass:dist', 'browserSync'],
            options: {
                logConcurrentOutput: true
            }
        }
    },

    /* SASS task */

     compass: {
        dist: {
            options: {
              sassDir: ['SASS/'],
              cssDir: ['css/'],
              environment: 'development', /* development | production */
              importPath: ['SASS/'],
              outputStyle: 'compressed', /* expanded for development | compressed for production */
              watch: true,
              sourcemap: true
            },
        },
        live: {
            options: {
              sassDir: ['SASS/'],
              cssDir: ['css/'],
              environment: 'production', /* development | production */
              importPath: ['SASS/'],
              outputStyle: 'compressed', /* expanded for development | compressed for production */
              watch: false,
              force: true,                      
            },
        },          
    },      

    /* Javascript Tasks */

    uglify: {
        // Uglify files

        build: {
            src: [
                'js/all-js/bootstrap.js',
                'js/all-js/site.js'
            ],
            dest: 'js/site.min.js'
        }

    },

    /* Run tasks when needed */

    watch: {            
        js: {
            files: ['js/all-js/*.js'],
            tasks: ['uglify'],
            options: { livereload: true }
        },
        gruntfile: {
            files: ['Gruntfile.js'],
            options: {reload: true}
        }
    },

    /* Browser Reload with BrowserSync */

    browserSync: {
        bsFiles: {
            src : [
                'css/**/*.css',
                'js/site.min.js',
                '**/*.php'
            ]
        },
    }       


});

// Where we tell Grunt what to do when we type "grunt" into the terminal.

grunt.registerTask('default', ['concurrent:watch']);
grunt.registerTask('live', ['compass:live']);
})

这是我的package.json文件:

    {
      "name": "ourframework",
      "version": "0.1.0",
      "devDependencies": {
      "grunt": "~0.4.1",
      "grunt-contrib-compass": "*",
      "grunt-browser-sync": "*",
      "grunt-contrib-watch": "*",
      "grunt-concurrent": "*",
      "grunt-contrib-uglify": "*",      
      "matchdep": "*"
    }
   }

查看grunt输出中的时间戳,例如:

Completed in 3.740s at Tue Jan 05 2016 13:11:10
Completed in 1.885s at Tue Jan 05 2016 13:12:04
请注意,这些编译间隔一分钟-您正在运行grunt
watch
任务。这将监视一组指定的文件,并在有任何更改时重新运行任务

没有“循环”-它只会在每次发生更改时重新编译,这通常是可取的

您可以看到默认任务设置为
concurrent:watch

grunt.registerTask('default', ['concurrent:watch']);

因此,如果您只需键入
grunt
,它将运行该任务。

查看grunt输出中的时间戳,例如:

Completed in 3.740s at Tue Jan 05 2016 13:11:10
Completed in 1.885s at Tue Jan 05 2016 13:12:04
请注意,这些编译间隔一分钟-您正在运行grunt
watch
任务。这将监视一组指定的文件,并在有任何更改时重新运行任务

没有“循环”-它只会在每次发生更改时重新编译,这通常是可取的

您可以看到默认任务设置为
concurrent:watch

grunt.registerTask('default', ['concurrent:watch']);

因此,如果您只需键入
grunt
,它将运行该任务。

我刚刚在另一台计算机上测试了此精确设置,运行良好!请阅读下面我的答案-它将始终运行良好,因为没有问题。你所看到的“循环”只是编译过程,稍后会发生一些变化。我刚刚在另一台计算机上测试了这个精确的设置,运行良好!请阅读下面我的答案-它将始终运行良好,因为没有问题。您看到的“循环”只是稍后发生的编译,当某些内容发生更改时。