Sunday 28 May 2017

Yeoman cannot find generator

I am trying to create a yeoman generator (it's already published on npm), but I've hit a few snags.

I'm not sure if this is related to my node setup or the code. I've troubleshooted with the help of a couple of similar issues:

I can successfully run other generators, so I'm fairly certain, at this point, this is a code issue.

Generator is installed alongside yo.

$ nvm use 7
Now using node v7.7.4 (npm v4.1.2)
$ npm install -g generator-spike yo
$ ls /Users/developer/.nvm/versions/node/v7.7.4/lib/node_modules
generator-generator generator-spike     http-server     npm         yarn            yo
$ ls /Users/developer/.nvm/versions/node/v7.7.4/lib/node_modules/generator-spike
README.md   actions     app     base.js     node_modules    package.json

Yo is installed correctly.

$ yo doctor

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

Everything looks all right!

Yeoman finds the generators.

$ yo --generators
Available Generators:

  generator
    subgenerator
  spike
    actions

But yo cannot run the generators:

$ yo spike:actions -f yada
Error spike:actions -f yada 

You don’t seem to have a generator with the name “spike:actions” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/. 
Install them with npm install generator-spike:actions.

To see all your installed generators run yo without any arguments. Adding the --help option will also show subgenerators. 

If yo cannot find the generator, run yo doctor to troubleshoot your system.



via Eric H.

No comments:

Post a Comment