Fatal error: Unable to find local grunt.

環境

  • MacOSX 10.11
  • Grunt: v0.1.13
  • node: v5.5.0

    Grunt構築内容

% brew install node
% npm install -g grunt-cli

Gruntfile.jspackage.json は作成済み.

エラー内容

% grunt build
grunt-cli: The grunt command line interface. (v0.1.13)

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

npmを確認

% sudo npm list
webapp@1.0.0 /Users/haru/Sites/xxx/
├── UNMET DEPENDENCY glob@^5.0.9
├── UNMET DEPENDENCY grunt@^0.4.5
├── UNMET DEPENDENCY grunt-cli@^0.1.13
├── UNMET DEPENDENCY grunt-contrib-clean@~0.6.0
├── UNMET DEPENDENCY grunt-contrib-compress@~0.13.0
├── UNMET DEPENDENCY grunt-contrib-concat@~0.5.1
├── UNMET DEPENDENCY grunt-contrib-csslint@^0.4.0
├── UNMET DEPENDENCY grunt-contrib-cssmin@^0.12.3
├── UNMET DEPENDENCY grunt-contrib-jshint@^0.11.2
├── UNMET DEPENDENCY grunt-contrib-less@^1.0.1
├── UNMET DEPENDENCY grunt-contrib-uglify@^0.9.1
├── UNMET DEPENDENCY grunt-contrib-watch@^0.6.1
├── UNMET DEPENDENCY grunt-githooks@^0.3.1
├── UNMET DEPENDENCY grunt-jsdoc@^0.6.4
├── UNMET DEPENDENCY grunt-notify@^0.4.1
├── UNMET DEPENDENCY grunt-sass@^1.0.0
└── UNMET DEPENDENCY node-path@^0.0.3

npm ERR! missing: glob@^5.0.9, required by webapp@1.0.0
npm ERR! missing: grunt@^0.4.5, required by webapp@1.0.0
npm ERR! missing: grunt-cli@^0.1.13, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-clean@~0.6.0, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-compress@~0.13.0, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-concat@~0.5.1, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-watch@^0.6.1, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-jshint@^0.11.2, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-uglify@^0.9.1, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-cssmin@^0.12.3, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-csslint@^0.4.0, required by webapp@1.0.0
npm ERR! missing: grunt-contrib-less@^1.0.1, required by webapp@1.0.0
npm ERR! missing: grunt-sass@^1.0.0, required by webapp@1.0.0
npm ERR! missing: grunt-jsdoc@^0.6.4, required by webapp@1.0.0
npm ERR! missing: grunt-notify@^0.4.1, required by webapp@1.0.0
npm ERR! missing: grunt-githooks@^0.3.1, required by webapp@1.0.0
npm ERR! missing: node-path@^0.0.3, required by webapp@1.0.0


解決方法

npm install していないだけだった.

% npm install
% grunt build
Done, without errors.