【问题标题】:yeoman-generator installation erroryeoman-generator 安装错误
【发布时间】:2015-09-08 12:31:40
【问题描述】:

我安装了 nodebrew、yeoman 和 2 个生成器(generator-webapp、generator-bootstrap)。但是 yeoman 似乎不知道生成器:

$ 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

但是我运行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

【问题讨论】:

  • 尝试通过$ yo更新您的生成器。

标签: npm yeoman


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-01-12
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2016-06-19
    • 2013-08-15
    • 2016-11-27
    相关资源
    最近更新 更多