yeoman / yo

CLI tool for running Yeoman generators
http://yeoman.io
BSD 2-Clause "Simplified" License
3.85k stars 399 forks source link

Can't find new generators #146

Closed silvenon closed 10 years ago

silvenon commented 10 years ago

I know a similar issue has occurred a few [times]() before, but most of them are either Windows related or 8 months old :D I'm on OS X and I'm using latest versions:

$ node -v && npm -v
v0.10.26
1.4.4

When I was trying to re-install generator-webapp, I noticed yo wasn't picking it up anymore. (I tried with generator-angular too, same thing.)

$ 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 12 registered generators run yo with the `--help` option.
$ yo --help
Usage: yo GENERATOR [args] [options]

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

Please choose a generator below.

Assemble
  assemble:app

Baseline
  baseline:app

Generator
  generator:app
  generator:subgenerator

H5bp
  h5bp:app

Htmlemail
  htmlemail:app

Jekyllized
  jekyllized:app

Jekyllrb
  jekyllrb:app

Mocha
  mocha:app

Phonegap
  phonegap:app

Sass-boilerplate
  sass-boilerplate:app

Yawa
  yawa:app

There's no Webapp. The weird thing is also that yo assemble doesn't work at some point here, but yo assemble:app worked. This changed when I ran brew update && brew upgrade node && npm install --force -g yo generator-webapp (also tried with npm cache clean). But yo still didn't manage to pick up Webapp, the --help output was the same, but now stuff like yo assemble worked.

I don't have $NODE_PATH set up, only this:

export PATH="/usr/local/share/npm/bin:$PATH"

I was exploring where my generators are located, the I found two places.

$ ls /usr/local/lib/node_modules/
bower
generator-angular
generator-karma
generator-mocha
generator-webapp
grunt-cli
grunt-usemin
npm
yo
$ ls /usr/local/share/npm/lib/node_modules/
autoprefixer
bower
coffee-script
coffeekup
coffeelint
cordova
csslint
gamma
generator-assemble
generator-baseline
generator-generator
generator-h5bp
generator-htmlemail
generator-jekyllized
generator-jekyllrb
generator-landing-page
generator-mocha
generator-phonegap
generator-sass-boilerplate
generator-test
generator-webapp
generator-yawa
grunt
grunt-bower-install
grunt-cli
grunt-coffeelint
grunt-init
gulp
handlebars
icomoon-build
imageoptim-cli
ios-sim
jade
jasmine-node
js2coffee
jshint
less
myth
node-sass
npm
phonegap
shelljs
svgo
uglify-js
yeoman
yo

Also, if it's of any use:

$ echo $(npm config get prefix)
/usr/local
silvenon commented 10 years ago

yo thinks everything is fine:

`$ yo doctor`
[Yeoman Doctor] Everything looks alright!

I also found out that generators which yo can use do not seem to be installed here.

$ npm ls -g | grep generator-
├─┬ generator-angular@0.7.1
├─┬ generator-karma@0.6.0
├─┬ generator-mocha@0.1.3
├─┬ generator-webapp@0.4.7

Maybe I screwed it up when I first updated npm when that certificate error occurred in this way:

$ npm config set ca ""
$ npm install -g npm

Then later I did:

$ brew upgrade node

Ok, I think I spammed you with enough info :)

SBoudrias commented 10 years ago

The issue is you have two location where your global node_modules/. That shouldn't be the case.

You probably broke something sometime with NPM. Tidy you setup and make sure it install to /usr/local/lib/node_modules/. Otherwise you could add the second node_modules/ location to your NODE_PATH. But you'd be better cleaning your NPM config - note you may have downloaded a bugged npm release...

silvenon commented 10 years ago

I completely reinstalled everything and it works fine. Not sure what happened, I probably downloaded a bugged npm release. Thanks for your help :)