Reputation: 13089
I created a new yeoman generator
'use strict';
var generators = require('yeoman-generator');
module.exports = generators.Base.extend({
method1: function() {
this.log('Hello, World!');
}
});
My package.json
{
"name": "generator-mygenerator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alexander Zeitler",
"license": "ISC",
"dependencies": {
"yeoman-generator": "^0.22.5"
}
}
Then I ran npm link
When calling yo mygenerator
I get this error:
Error mygenerator
You don't seem to have a generator with the name mygenerator installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 1 registered generators run yo with the `--help` option.
I also tried npm link generator-mygenerator
.
Node.js version 4.2.3
and npm version 3.7.5
.
I installed Node.js using nvm
yo doctor
results in this:
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
✔ NODE_PATH matches the npm root
Everything looks all right!
Upvotes: 1
Views: 1498
Reputation: 13089
The index.js
has to be inside the app
folder. It was in the project root folder instead.
Upvotes: 1