我安装了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
但是我在没有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
最佳答案
除了直接使用npm install之外,您还可以通过Yeoman交互式菜单搜索生成器。运行 yo 并选择安装生成器以搜索已发布的生成器。
关于npm - yeoman 发电机安装错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27854069/