2

I've installed grunt :

 sudo npm install -g grunt-cli
/Users/user/.nvm/versions/node/v4.3.0/bin/grunt -> /Users/user/.nvm/versions/node/v4.3.0/lib/node_modules/grunt-cli/bin/grunt
/Users/user/.nvm/versions/node/v4.3.0/lib
└── grunt-cli@1.2.0 

But when i run grunt i have errors:

grunt 
grunt-cli: The grunt command line interface (v1.2.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, 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

Where i am wrong please ?

Pracede
  • 4,226
  • 16
  • 65
  • 110
  • Possible duplicate of [Fatal error: Unable to find local grunt](http://stackoverflow.com/questions/13925916/fatal-error-unable-to-find-local-grunt) – Pracede Apr 15 '16 at 16:19

3 Answers3

4

you have to install grunt globally and locally

you have installed the cli globally with the -g flag

now you have to install it locally in your package.json with ...

npm install -SD grunt

then your "grunt" command will work - assuming you have a valid gruntfile

danday74
  • 52,471
  • 49
  • 232
  • 283
1

This looks like a duplicate of Fatal error: Unable to find local grunt.

In a nutshell, try running grunt:init or npm:init first (depending on the version you have. See linked question for more details.

Community
  • 1
  • 1
Adela Chang
  • 131
  • 2
1
  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
imbond
  • 2,030
  • 1
  • 20
  • 22