Closed jasonrhodes closed 8 years ago
Are you loading grunt-cli as a task in your file?
No... so grunt dev-validate
worked fine with globally installed grunt-cli, so i did npm install grunt-cli
and set up an npm script:
{
"scripts": {
"test:dev": "grunt dev-validate"
}
}
and now doing npm run test:dev
produces that warning. I don't really get why.
Figured it out! See: maenu/grunt-template-jasmine-istanbul#8 where @jdelight figured out the same issue:
It was to do with calling grunt.loadNpmTasks("grunt-template-jasmine-istanbul"). I had some script which automatically loaded anything starting with "grunt-".
So I've filter these template tasks out and it's fine now :)
So in our Gruntfile I've had to change this:
// load npm tasks for grunt-* libs
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
to this:
// load npm tasks for grunt-* libs, excluding grunt-cli
require('matchdep').filterDev('grunt-*').filter(function(pkg) {
return ['grunt-cli'].indexOf(pkg) < 0;
}).forEach(grunt.loadNpmTasks);
Yeap yeap!
When doing this: https://github.com/gruntjs/grunt-cli#installing-grunt-cli-locally and then running
grunt whatever
from an npm script, I always see this warning:and then everything seems to proceed fine after that. How can I silence that warning? I can't seem to find the text of the warning in this repo at all...
Note: this article mentions the same warning for the same reason -- https://glebbahmutov.com/blog/you-dont-need-global-grunt/