Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grunt --tasks broken #29

Closed
LandonSchropp opened this issue Sep 10, 2013 · 8 comments
Closed

grunt --tasks broken #29

LandonSchropp opened this issue Sep 10, 2013 · 8 comments

Comments

@LandonSchropp
Copy link

I'm using grunt version 0.4.1 and grunt-cli version 0.1.9. If I add this Gruntfile:

module.exports = function(grunt) {};

And I run grunt --tasks, I get the following error:

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
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 (/Users/landonschropp/Development/example/node_modules/grunt/lib/grunt/file.js:371:28)
    at task.loadTasks (/Users/landonschropp/Development/example/node_modules/grunt/lib/grunt/task.js:358:18)
    at Array.forEach (native)
    at Task.task.init (/Users/landonschropp/Development/example/node_modules/grunt/lib/grunt/task.js:444:33)
    at Object.grunt.tasks (/Users/landonschropp/Development/example/node_modules/grunt/lib/grunt.js:113:8)
    at Object.module.exports [as cli] (/Users/landonschropp/Development/example/node_modules/grunt/lib/grunt/cli.js:38:9)
    at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:41:20)
@cowboy
Copy link
Member

cowboy commented Sep 10, 2013

The grunt --tasks option requires an additional argument, which is a directory path to scan for task files. See grunt --help for more information.

@cowboy cowboy closed this as completed Sep 10, 2013
@LandonSchropp
Copy link
Author

I don't think this issue should be closed. The task should display an error message to the user rather than a stack trace. The stack trace isn't actionable to a user. Furthermore, in my opinion the documentation isn't clear about what the flag expects. Besides, why can't grunt --tasks use the current directory by default?

@cowboy
Copy link
Member

cowboy commented Sep 11, 2013

The way the command line parser works is that because --tasks expects an additional argument, it will consume whatever follows it. Doing grunt mytask --tasks ./tasksdir will work the same as grunt --tasks ./tasksdir mytask. But they will behave totally differently if you omit the necessary argument after --tasks.

That being said, I'm all for better error messages. Can you open a ticket about improving error messages with misused command line options?

@cowboy
Copy link
Member

cowboy commented Sep 11, 2013

(And reference this ticket, too)

@guillermo
Copy link

Ok. Thanks. Went through the same process.

Used to rake -T, run grunt --tasks and start googling.

@ulidtko
Copy link

ulidtko commented Aug 31, 2014

Uhhh. So, again, how do I list available tasks?..

Seeing a traceback is not particularly enlightening when a user wants to do something very simple.

@bisrael
Copy link

bisrael commented Apr 14, 2015

@ulidtko -- do grunt -h and you'll see the available tasks after all of the options you can pass.

@shamess
Copy link

shamess commented Apr 18, 2015

Thanks, @bisrael. That was what I was looking for too - didn't spot it first time around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants