Grunt错误:找不到任务目录“任务”

时间:2014-02-21 05:28:53

标签: gruntjs

当我尝试在OS X Mavericks 10.9终端中运行Grunt时输入grunt并返回我收到以下错误消息:

    >> Tasks directory "tasks" not found.

    Running "jshint:all" (jshint) task
    ERROR: Can't find config file: .jshintrc
    Jim-MacBookPro:MyDirectory jmpreston$ grunt
    >> Tasks directory "tasks" not found.

如果我输入grunt -tasks,我会看到以下以及上面的tasks目录错误:

    TypeError: Arguments to path.join must be strings
        at path.js:360:15
        at Array.filter (native)
        at Object.exports.join (path.js:358:36)
        at Object.file.exists
    (/Applications/MAMP/htdocs/MyDirectory/node_modules/grunt/lib/grunt/file.js:373:28)
        at task.loadTasks 
    (/Applications/MAMP/htdocs/MyDirectory/node_modules/grunt/lib/grunt/task.js:364:18)
        at Array.forEach (native)
        at Task.task.init
    (/Applications/MAMP/htdocs/MyDirectory/node_modules/grunt/lib/grunt/task.js:450:33)
        at Object.grunt.tasks
    (/Applications/MAMP/htdocs/MyDirectory/node_modules/grunt/lib/grunt.js:113:8)
        at Object.module.exports [as cli]        
    (/Applications/MAMP/htdocs/MyDirectory/node_modules/grunt/lib/grunt/cli.js:38:9)
        at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:45:20)

Grunt似乎明白它需要查看/ node_modules /文件夹以及那些与原始安装一起存在的文件夹。我在Compass和Foundation 5之后安装了Grunt。原始安装没有任务文件夹。我检查了Grunt文档+在网上搜索,没有任何帮助。一个人在Stack Overflow上提到他遇到了这个问题然后回答说他没有说明如何修复它。

grunt-cli v0.1.13

我不是一个程序员,但通常可以阅读和破解js和php。这是我第一次使用Foundation / Compass / Grunt。我让Git和GitHub工作正常。

任何想法有什么不对?

1 个答案:

答案 0 :(得分:0)

从github.com/gruntjs/grunt-contrib-compass下载的完整gruntfile.js包含许多可能没用的代码。我的错误是认为这个代码与设置过程有关,就像正常的软件设置一样。

对于noobie而言令人困惑的是,在终端/命令行中设置grunt的过程不会设置下载的gruntfile中的任务和任务文件夹。我可能还没有彻底解决这个问题,但初始设置和Github上的文件之间似乎没有直接联系。 Github上的代码只是示例,需要删除或破解为有用。

谢谢@Kyle帮我解决这个问题!

相关问题