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

Fatal error: Unable to find local grunt. #38

Closed
johnjbarton opened this issue Jan 10, 2014 · 11 comments

Comments

Projects
None yet
@johnjbarton
Copy link

commented Jan 10, 2014

Pretty much my user experience with grunt:

>grunt
grunt-cli: The grunt command line interface. (v0.1.11)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

Ok, then:

>sudo npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/findup-sync
npm http GET https://registry.npmjs.org/resolve
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
grunt-cli@0.1.11 /usr/local/lib/node_modules/grunt-cli
├── resolve@0.3.1
├── nopt@1.0.10 (abbrev@1.0.4)
└── findup-sync@0.1.2 (lodash@1.0.1, glob@3.1.21)
> grunt

Same as above

@cowboy

This comment has been minimized.

Copy link
Member

commented Jan 10, 2014

You need to install Grunt locally.

If you're Working with an existing Grunt project see step 2 of that section in the Grunt "Getting Started" guide.

If you're Preparing a new Grunt project this is explained in the Installing Grunt and gruntplugins sub-section of that section in the guide.

Either way, you should take a look at the Grunt "Getting Started" guide, and if you're working with an existing project, please consider asking the project maintainer to link to that guide in their README or documentation.

Thanks!

@cowboy cowboy closed this Jan 10, 2014

@johnjbarton

This comment has been minimized.

Copy link
Author

commented Jan 10, 2014

Thanks! Now I would like to suggest that you documentation can be improved.

Consider your error message from the point of view of a user:

>grunt
grunt-cli: The grunt command line interface. (v0.1.11)

Fatal error: Unable to find local grunt.

This message seem ridiculous. It cause a user to think: "Wakeup, I just issued my local grunt command! Obviously you found yourself, what are you talking about??"

The subsequent text suggests reading the "Getting Started". Obviously I did that. I followed the suggestion, even though the above text "grunt-cli: The grunt command line interface. (v0.1.11)" claims that grunt-cli is already available. I gave the error message the benefit of the doubt and continued with "sudo npm install -g grunt-cli".

This of course failed.

Now I understand that one additional step is required, a step which the error message fails to mention but which is critical for progress: 'npm install'. I'm sure as an expert that makes perfect sense to you. But I hope your docs and error messages do not target experts but rather folks who want to succeed in using Grunt to build existing projects. Having been successful in using Grunt on another project, they will be encouraged to learn more about these obscure additional commands.

Perhaps the bug here is the error message: shouldn't it say "Grunt not found in project dependencies" or some such?

@mookman288

This comment has been minimized.

Copy link

commented Jan 21, 2014

I agree with johnjbarton, I thought this meant local to the user (/usr/bin/local,) as opposed to locally within the project. Grunt not found in project dependencies would be much more fitting.

@trevithj

This comment has been minimized.

Copy link

commented Jan 27, 2014

I second the above. Suggest the culprit may be that the Getting Started guide assumes a new user can tell the difference between grunt-cli and grunt the task runner. From my POV, the command line interface is grunt, so I assume once grunt-cli is loaded, I'm good to go.

For others searching this issue:

  1. install the command-line interface:
    npm install -g grunt-cli
  2. install the local task runner:
    cd [my project root]
    npm install grunt --save-dev
  3. define your Gruntfile.js as per http://gruntjs.com/getting-started#the-gruntfile
  4. run the tasks with: grunt

That will get you started. Regards step 2, recommend reading http://gruntjs.com/getting-started#package.json for an alternative approach. Namely: create a package.json file that defines grunt as a devDependency, then run npm install

@danpaulsmith

This comment has been minimized.

Copy link

commented Aug 20, 2014

I also continuously get "Fatal local grunt not found" after what I think is installing grunt locally for a project directory. Even after doing those steps above I then 90% of the time get missing module errors:

  1. install the command-line interface:
    npm install -g grunt-cli
  2. install the local task runner:
    cd [my project root]
    npm install grunt --save-dev
  3. define your Gruntfile.js as per http://gruntjs.com/getting-started#the-gruntfile
  4. run the tasks with: grunt

Local Npm module "grunt-contrib-clean" not found. Is it installed?
Local Npm module "grunt-contrib-coffee" not found. Is it installed?
Local Npm module "grunt-contrib-concat" not found. Is it installed?
Local Npm module "grunt-contrib-uglify" not found. Is it installed?
Local Npm module "grunt-contrib-compress" not found. Is it installed?
Local Npm module "grunt-contrib-qunit" not found. Is it installed?
Local Npm module "grunt-contrib-watch" not found. Is it installed?
Warning: Task "serve" not found. Use --force to continue.

Why am I so bad at terminal?

@stephaneeybert

This comment has been minimized.

Copy link

commented Mar 13, 2015

On my previous Linux box I succeeded in using grunt from a project directory, without having a node_modules directory in it. But I cannot replicate this on a new Linux machine. The .profile file contains in both cases: export NODE_HOME=/home/stephane/programs/install; PATH=$PATH:$NODE_HOME/bin; export NODE_PATH=/home/stephane/programs/install/lib/node_modules

@anakinjay

This comment has been minimized.

Copy link

commented Apr 1, 2015

+1 for this. I'm new to grunt and just spent hours trying to figure this error message out. Even something like:

"Unable to find local grunt. Have you installed grunt locally with 'npm install' ?"

would be much much better.

@westerdaled

This comment has been minimized.

Copy link

commented Apr 18, 2016

I am also finding getting Grunt to work very torturous. http://stackoverflow.com/questions/36663055/grunt-serve-warning-task-serve-not-found-use-force-to-continue-revisited?noredirect=1#comment60934232_36663055 . I am now stuck

Warning: Task "serve" not found. Use --force to continue

@AurelioDeRosa

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2016

The problem might come from the fact that you're using a newer version of webapp-generator. This boilerplate has moved from Grunt to Gulp, that's why it isn't working. Check if you find a gulpfile.js in your folder.

@larka06

This comment has been minimized.

Copy link

commented Nov 7, 2016

I fine the grunt starter page useless...it assumes to many things are known...I was not able to find the info I needed to understand being new to this subject

@mannyr7

This comment has been minimized.

Copy link

commented Sep 30, 2018

First off, I am new to this. It started with wanting to install and run, pyjs on my Windows machine. No groans please. So, down the rabbit hole we go with installing dependencies, composer, npm, jquery, node js, eslint, ajv, and finally stuck here at grunt. As stated above, WAY too much is assumed on the Getting-Started page. I just want to run Hello.py after the bootstrap install. Being new, I have no clue what SHOULD go in a gruntfile, what resources commonly need referencing or where to properly put it for this and other projects. By a global install, I assumed the same gruntfile would be found and used for every project, but not so, or I am doing it completely wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.