yeoman-发电机安装错误

时间:2015-01-09 04:55:15

标签: npm yeoman

我安装了nodebrew,yeoman和2个生成器(generator-webapp,generator-bootstrap)。但自耕农似乎不知道那些发电机:

$ yo webapp
Error webapp 

You don't seem to have a generator with the name webapp installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 3 registered generators run yo with the `--help` option.

(当它是yo bootstrap时,会发生类似的错误。)

所以我运行yo --help,但它没有显示任何生成器:

$ yo --help
Usage: yo GENERATOR [args] [options]

General options:
 -h, --help     # Print generator's options and usage
-f, --force    # Overwrite files that already exist

但是我没有args运行yo,显示了生成器:

$ yo
? 'Allo mehtats! What would you like to do? (Use arrow keys)
  Run a generator
❯ Bootstrap 
  Webapp 
  Mocha 
  ──────────────
  Update your generators 
  Install a generator 
  Find some help 
  Get me out of here! 
  ──────────────

然后我选择Webapp并运行此生成器,发生错误:

Make sure you are in the directory you want to scaffold into.
This generator can also be run with: yo webapp


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

Out of the box I include HTML5 Boilerplate, jQuery, and a Gruntfile.js to build your app.
? What more would you like? Bootstrap
   create Gruntfile.js
   create package.json
   create .gitignore
   create .gitattributes
   create .bowerrc
   create bower.json
   create .jshintrc
   create .editorconfig
   create app/styles/main.css
   create app/favicon.ico
   create app/robots.txt
   create app/index.html
   create app/scripts/main.js
Error  

You don't seem to have a generator with the name mocha installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 3 registered generators run yo with the `--help` option.

我提到了其他问题而做npm install --force -g webapp,但没有解决。

yo doctor说:

$ yo doctor
[Yeoman Doctor] Everything looks all right!

版本:

$ yo -v
1.4.0
$ node -v
v0.11.14

1 个答案:

答案 0 :(得分:0)

除了直接使用npm install之外,您还可以通过Yeoman交互式菜单搜索生成器。运行 yo 并选择安装生成器以搜索已发布的生成器。

enter image description here