Using OSX Maveriks, iTerminal, zsh.
Problem: Grunt runs only the default task regardless of the task you specify. Problem: It only happens in 1 computer.
What can be the reason for grunt not to run but the default task. I've been working with Grunt for a long time now and we use it at the company I work at. Everything has been working perfectly smooth except for 1 single coworker that when he runs grunt myTask
is like if he were running just grunt
, even if I run a made up task like grunt myNotExistentTask
it ignores it and again looks like it runs grunt
.
I did check for stupid errors:
- Checked that I'm accessing the same project folder (multiple times).
- I deleted the default task to see if it complained and it does.
- I checked that the Gruntfile was not throwing errors. Then I forced to throw errors to see if it would complain, and it does.
- Runned
npm install
. - Check both bashrc and zshrc for a grunt command or something.
- Obviously grunt is accessible.
- Runned it in the default terminal and in iTerm.
- "Have you try to turn it on and off?" Yes I did restar the laptop.
- I tried with multiple coworkers laptops and it only happens in the one laptop.
I did not have time to (but I will check for these):
- test creating a simple Gruntfile somewhere else in his laptop, but I have a weird feeling that it would behave the same way.
- reinstall grunt. Would that help?
grunt --version
or others for that matter, I assumed that it has the specified version in thepackage.json
.
we are using:
"grunt-cli": "^0.1.13",
"grunt": "^0.4.4"
The code is not causing the issue here because every computer runs it but one. I can't show the actual code but I can give you the boilerplate just in case there is some mysterious thing I don't know about:
module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
someTask : {
options : {
},
target1 : {
}
}
});
grunt.loadNpmTasks("dependency1");
grunt.loadNpmTasks("dependency2");
grunt.loadNpmTasks("etc");
grunt.registerTask("default", function () {
// creates a server with one of the dependencies
});
grunt.registerTask("w", function () {
// creates a watch with one of the dependencies
});
};
There is a reason behind why we are not simply doing something like grunt.registerTask("default", [".."])
. Basically, our projects are too big and we need to change settings for each task to increase performance (e.g. not to watch too many files, etc).
I googled this different ways and couldn't find anything about this happening before. Any ideas are welcomed.
Edit
I forgot to mention that he has been working with the project for a while, we just recently noticed because he never needed to use any other task but the default task until a few days ago when he needed to use a different task, in summary, we don't know when or why it started.