Generator-angular does not create a new project

I am new to the Yeomen toolbox. I run the following commands in Ubuntu 12

$ npm install -g yo $ npm install -g generator-webapp $ yo webapp 

I can create a web application project. After that, I tried to create an angular project. First i run the command

 $ npm install -g generator-angular 

And there will be no errors when installing this generator.

When i run the command

 $ yo angular 

I get an error message:

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

How to resolve this? When i run the command

  $ ls $(npm config get prefix)/lib/node_modules 

:

 bower generator-angular generator-karma generator-mocha generator-webapp grunt-cli yo 

The same problem occurred when I use the generator setup with

 $ npm install -g generator-backbone 

It successfully installs the package and when I run the command in an empty folder

 $ yo backbone 

He gives a way out

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

When i run the command

 $ npm config get prefix 

It gives me a way out

 /home/ritesh/npm 

Perhaps I am mistaken in this way. Can anyone tell how to solve it?

+7
yeoman yeoman-generator yeoman-generator-angular
source share
2 answers

NODE_PATH is probably misconfigured. In this case, just add the NPM prefix to NODE_PATH . If you run yo doctor , the output will most likely look like this:

 [Yeoman Doctor] Uh oh, I found potential errors on your machine --------------- [Error] NPM root value is not in your NODE_PATH [info] NODE_PATH = /usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript NPM root = /home/eliranm/npm/lib/node_modules [Fix] Append the NPM root value to your NODE_PATH variable Add this line to your .bashrc export NODE_PATH=$NODE_PATH:/home/eliranm/npm/lib/node_modules Or run this command echo "export NODE_PATH=$NODE_PATH:/home/eliranm/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc 

So, to solve this, just follow the doctor’s directions. If you prefer to change the .profile configuration over bash, just do this:

 echo "export NODE_PATH=$NODE_PATH:/home/eliranm/npm/lib/node_modules" >> ~/.profile && source ~/.profile 
+6
source share

In my case

EXPRESSION: "yo doctor" cannot find errors in Windows 10. Updating yoman did not fix it. FIX: May be a resolution problem. I opened the command line as administrator, ran yo xxxx, it worked.

0
source share

All Articles