Yeoman angular generator install runs but generator doesn't appear in generator list
Asked Answered
N

3

16

I've tried to install the yeoman angular generator with the following:

npm install -g generator-angular

It all looks like it's installed properly...

...
npm http GET https://registry.npmjs.org/string_decoder
npm http 304 https://registry.npmjs.org/string_decoder
npm http GET https://registry.npmjs.org/event-emitter
npm http GET https://registry.npmjs.org/next-tick
npm http 304 https://registry.npmjs.org/event-emitter
npm http 304 https://registry.npmjs.org/next-tick
[email protected] /Users/rich/.node/lib/node_modules/generator-angular
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Full log here: https://dl.dropboxusercontent.com/s/hs5dgy1i6f90vu4/angular-generator-log.txt

But every time I do: yo angular I get: You don't seem to have a generator with the name angular installed.

yo doctor says everything is ok and I have angular installed globally with npm.

yo --help shows:

Please choose a generator below.


Mocha
  mocha:app

Webapp
  webapp:app

I'm a bit baffled as there aren't any errors with installation...?

Nassi answered 18/3, 2014 at 23:33 Comment(3)
See this answer: #18081625Forepleasure
I'm having the same problem as you and unlike the answer linked in the comment above, I don't have a 2nd folder with node-modules and my NODE_PATH is set. yo doctor says everything is cool but new generators are not recognized.Brawn
I've seen some issues when people install node/npm through the .pkg and then update it through brew (or vice versa), basically what happens is that 2 global node_modules folders are created in different places. If you happen to have installed Node in more than one fashion, this might be your issue. Try to npm i -g yeoman again or even unistall all the node.js and npm on your machine and install it again.Feet
B
34

Strangely enough I fixed this very same problem by replacing

npm install -g generator-angular

with

npm install -G generator-angular

Note the capital G in the second command

Bejewel answered 3/12, 2014 at 14:11 Comment(5)
There is no documented difference between -g and -G. See the npm install docsNobby
@DanPantry fair enough, I double checked as well, but given the issue, that did work for me :OBejewel
could it be that -G works for all users and -g works for "sudos"? I ran into the issue and realized that after having to use sudo in my installation of generator-meanjs, I couldn't run yo meanjs unless I used sudo in conjunction with @Ricardo Rivas' answerUpu
Guys... There is no flag named '-G'. So, if you run something like this 'npm install -G' then module with be installed to the local 'node_modules'. That's why it works for you :)Dastard
Hi everyone, sorry for waking this post up once again, what @TarasRomaniv said is true, but then it is not a good solution yet, it is just a running solution. Since the tutorial said we need to install it globally but it did't work, then what? which one is true?Shani
A
0

I used this

npm remove -g yo generator-* yeoman-generator 
npm install -g yo generator-angular

and now everything works very well

Anther answered 30/12, 2015 at 15:31 Comment(0)
L
-4

I've seen this problem a bunch of times, there are some problems because of node path. What you can do to fix this is very simple. You just need to tell node what is going to be the folder for global packages and this folder needs to have the same permissions as the user.

return the node path

npm config get prefix

create a node folder that you can destroy whenever you want

mkdir -p ~/.node

tell node to use this folder

npm config set prefix ~/.node

then try again npm install -g yo

Linc answered 7/11, 2014 at 19:19 Comment(1)
This is also a way . And i say that if a solution does not fit for your situation it's not necessary that it's wrong . and @Ricardo dear , you solution is good but very poorly explained .Kindly update it so that other can take advantage of itLysimeter

© 2022 - 2024 — McMap. All rights reserved.