grunt-contrib-watch导致超出最大调用堆栈大小 [英] grunt-contrib-watch causing Maximum call stack size exceeded

查看:91
本文介绍了grunt-contrib-watch导致超出最大调用堆栈大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行干净任务(grunt clean)时,一切都按预期工作,但是当我运行watch任务(grunt test)时,出现以下错误:

  util.js:35 
var str = String(f).replace(formatRegExp,function(x){
^
RangeError:最大调用堆栈大小超过

这里是我的gruntfile



<$ p $ module.exports =(grunt) - >

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

clean:['tmpDir /']

watch:
options:
spawn:false
src:
tasks:['干净']
文件:[
src:'client / assets / strings / en / str.coffee'
]

#plugins
grunt。 loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-watch')

#tasks
grunt.registerTask('test',[''手表'))

这是我的package.json文件:

  {
author :您的姓名<您的电子邮件>,
姓名:app-name,
description:应用程序描述,
version:0.0.1 ,
homepage:,
repository:{
type:git,
url:
},
engines:{
node:〜0.10.28
},
scripts:{
start:muffin server

dependencies:{
coffee-script:〜1.1.2,
express:〜3.0.6,
chai:〜1.4.2,
下划线:〜1.4.3,
wd:0.0.27
},
devDependencies:{
express:〜3.0.6,
grunt:^ 0.4.5,
grunt-contrib-coffee:^ 0.11 .1,
grunt-contrib-copy:^ 0.6.0,
grunt-contrib-less:^ 0.11.4,
grunt-contrib -watch:^ 0.6.1,
requirejs:〜2.0.1
}
}

使用--ver运行时的输出bose是以下内容:
注意:用***替换基本路径

 初始化
命令行选项:--verbose

读取gruntfile.coffeeGruntfile ...确定

注册Gruntfile任务。
阅读package.json ... OK
解析package.json ... OK
初始化配置... OK

注册grunt-contrib-clean本地Npm模块任务。
阅读/***/node_modules/grunt-contrib-clean/package.json...OK
解析/***/node_modules/grunt-contrib-clean/package.json...OK
加载clean.js任务... OK
+ clean

注册grunt-contrib-watch本地Npm模块任务。
阅读/***/node_modules/grunt-contrib-watch/package.json...OK
解析/***/node_modules/grunt-contrib-watch/package.json...OK
加载watch.js任务... OK
+ watch
加载gruntfile.coffee任务... OK
+ test

运行任务:测试

运行测试任务

运行监视任务
等待...
验证属性监视器存在于config中.. .OK
验证属性watch.src.files存在于config中... OK
Warning:Object#< Object>没有方法'indexOf'

运行watch任务
等待...
验证属性watch存在于config中... OK
验证属性watch.src .files存在于config中... OK
Warning:Object#< Object>没有方法'indexOf'

...其中许多

运行watch任务
等待...
验证属性监视存在于config ... OK
验证属性watch.src.files存在于config中... OK
Warning:Object#< Object>没有方法'indexOf'

(node)警告:检测到递归process.nextTick。这将在下一个版本的节点中打破。请使用setImmediate进行递归延期。
(节点)警告:检测到递归process.nextTick。这将在下一个版本的节点中打破。请使用setImmediate进行递归延期。
...许多这些
(节点)警告:检测到递归process.nextTick。这将在下一个版本的节点中打破。请使用setImmediate进行递归延期。

util.js:35
var str = String(f).replace(formatRegExp,function(x){
^
RangeError:超出最大调用堆栈大小


解决方案

文件 property需要一个文件模式字符串数组,你提供了一个它不知道如何解释的对象。



更改:

 文件:[
src:'client / assets / strings / en / str.coffee'
]

至此:

  b 










$ b $

When I execute the clean task (grunt clean), everything works as expected but when I run the watch task (grunt test), I get the following error:

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                  ^
RangeError: Maximum call stack size exceeded

Here's my gruntfile

module.exports = (grunt) ->

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

    clean: ['tmpDir/']

    watch:
      options:
        spawn: false
      src:
        tasks: ['clean']
        files: [
          src: 'client/assets/strings/en/str.coffee'
        ]

  # plugins
  grunt.loadNpmTasks('grunt-contrib-clean')
  grunt.loadNpmTasks('grunt-contrib-watch')

  # tasks
  grunt.registerTask('test', ['watch'])

Here's my package.json file:

{
  "author": "Your Name <Your Email>",
  "name": "app-name",
  "description": "Application description",
  "version": "0.0.1",
  "homepage": "",
  "repository": {
    "type": "git",
    "url": ""
  },
  "engines": {
    "node": "~0.10.28"
  },
  "scripts": {
    "start": "muffin server"
  },
  "dependencies": {
    "coffee-script": "~1.1.2",
    "express": "~3.0.6",
    "chai": "~1.4.2",
    "underscore": "~1.4.3",
    "wd": "0.0.27"
  },
  "devDependencies": {
    "express": "~3.0.6",
    "grunt": "^0.4.5",
    "grunt-contrib-coffee": "^0.11.1",
    "grunt-contrib-copy": "^0.6.0",
    "grunt-contrib-less": "^0.11.4",
    "grunt-contrib-watch": "^0.6.1",
    "requirejs": "~2.0.1"
  }
}

The output when I run with --verbose is the following: Note: replaced base path with ***

Initializing
Command-line options: --verbose

Reading "gruntfile.coffee" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-contrib-clean" local Npm module tasks.
Reading /***/node_modules/grunt-contrib-clean/package.json...OK
Parsing /***/node_modules/grunt-contrib-clean/package.json...OK
Loading "clean.js" tasks...OK
+ clean

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /***/node_modules/grunt-contrib-watch/package.json...OK
Parsing /***/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "gruntfile.coffee" tasks...OK
+ test

Running tasks: test

Running "test" task

Running "watch" task
Waiting...
Verifying property watch exists in config...OK
Verifying property watch.src.files exists in config...OK
Warning: Object #<Object> has no method 'indexOf'

Running "watch" task
Waiting...
Verifying property watch exists in config...OK
Verifying property watch.src.files exists in config...OK
Warning: Object #<Object> has no method 'indexOf'

... many of these

Running "watch" task
Waiting...
Verifying property watch exists in config...OK
Verifying property watch.src.files exists in config...OK
Warning: Object #<Object> has no method 'indexOf'

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
... many of these
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded

解决方案

The files property takes an Array of file pattern strings. You've supplied an object it doesn't know how to interpret.

Change this:

files: [
  src: 'client/assets/strings/en/str.coffee'
]

To this:

files: [
  'client/assets/strings/en/str.coffee'
]

这篇关于grunt-contrib-watch导致超出最大调用堆栈大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆