smt
9/25/2012 - 3:12 AM

Default Yeoman custom generator can't find globally-installed Yeoman when run

Default Yeoman custom generator can't find globally-installed Yeoman when run

~ ❯ mkdir test && cd test

~/test ❯ yeoman init generator foo
Running "init:yeoman" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.

"yeoman" template notes:



     _-----_
    |       |
    |--(o)--|   .--------------------------.
   `---------´  |    Welcome to Yeoman,    |
    ( _´U`_ )   |   ladies and gentlemen!  |
    /___A___\   '__________________________'
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

Out of the box I include HTML5 Boilerplate, jQuery and Modernizr.

   invoke  generator
   create    lib/generators/foo/index.js
   create    lib/generators/foo/templates/.empty_directory
   create    lib/generators/foo/USAGE
   invoke      mocha:generator
   create        test/generators/test-foo.js

~/test ❯ yeoman init foo
Running "init:yeoman" (init) task
<WARN> Cannot find module 'yeoman' Use --force to continue. </WARN>

Aborted due to warnings.

~/test ❯ cat lib/generators/foo/index.js                                                                                                                                                                    

var util   = require('util');
var yeoman = require('yeoman');

module.exports = Generator;

function Generator() {
  yeoman.generators.NamedBase.apply(this, arguments);

  // this is the default. Uncomment and change the path if you want
  // to change the source root directory for this generator.
  //
  // this.sourceRoot(path.join(__dirname, 'templates'));

}

util.inherits(Generator, yeoman.generators.NamedBase);

Generator.prototype.createSomething = function() {};

~/test ❯ which yeoman
/usr/local/bin/yeoman

~/test ❯ npm list -g | grep yeoman
└─┬ yeoman@0.9.1
  └─┬ yeoman-generators@0.9.1