chrisdwheatley / generator-angular2

A Yeoman Generator to create Angular2 apps right now.
https://npmjs.com/package/generator-angular2
MIT License
253 stars 41 forks source link

Error when running the command yo angular2 #44

Open ghost opened 8 years ago

ghost commented 8 years ago

I've followed as per your tutorials and find the following error when running yo angular2.

Error angular2 

You don't seem to have a generator with the name angular2 installed.
You can see available generators with npm search yeoman-generator 
and then install them with npm install [name].

The yo and angular-generator has been installed using the following command: npm install -g yo generator-angular2

Ariestattoo commented 8 years ago

what happens when you simply type yo in the console? Is it in the available list?

chrisdwheatley commented 8 years ago

Yeah it sounds like the installation may have failed, try re-running npm install -g yo generator-angular2 and see if there are any errors reported.

ghost commented 8 years ago

@Ariestattoo when typed yo the following menu comes up:

? 'Allo Anoop! What would you like to do? (Use arrow keys)
  Run a generator
❯ Angular 
  Express Angular 
  Ionic 
  Mobileangularui 
  Webapp 
  Karma 
(Move up and down to reveal more choices)

@swirlycheetah I've run the command sudo npm install -g yo generator-angular2 many times, before posting this bug and even as I'm typing :(

Ariestattoo commented 8 years ago

In general it would be preferable not to run the install as a superuser. What output are you receiving when running the install as swirlycheetah recommended?

ghost commented 8 years ago

When running without sudo:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/generator-angular2
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/yo
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
+-- generator-angular2@0.6.4 
`-- yo@1.7.0 

npm ERR! Linux 3.16.0-67-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yo" "generator-angular2"
npm ERR! node v5.9.0
npm ERR! npm  v3.7.3
npm ERR! path /usr/local/lib/node_modules/generator-angular2
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-angular2'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-angular2']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/generator-angular2' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/anoop/npm-debug.log
ghost commented 8 years ago

Running yo

? 'Allo Anoop! What would you like to do? (Use arrow keys)
  Run a generator
❯ Angular 
  Express Angular 
  Ionic 
  Mobileangularui 
  Webapp 
  Karma 
chrisdwheatley commented 8 years ago

It looks like without sudo the install is failing due to permission issues. When you run sudo npm install -g generator-angular2 what is the output in the console?

vuxor commented 8 years ago

If you are trying to install with "-g" flag that means it will be installed globally on your system and that's why you need to run this command with "sudo".

ghost commented 8 years ago

@swirlycheetah when using sudo npm install -g generator-angular I get the following:

 yo@1.7.0 postinstall /usr/local/lib/node_modules/yo
> yodoctor

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

Everything looks all right!
- color-convert@1.0.0 node_modules/generator-angular2/node_modules/color-convert
- color-convert@1.0.0 node_modules/yo/node_modules/color-convert
/usr/local/lib
+-- generator-angular2@0.6.4 
| +-- chalk@1.0.0
| | `-- ansi-styles@2.2.1 
| +-- npm-check@3.2.10
| | `-- npm-registry-client@6.5.1
| |   `-- request@2.69.0
| |     +-- har-validator@2.0.6
| |     | `-- chalk@1.1.3 
| |     `-- http-signature@1.1.1
| |       `-- sshpk@1.7.4
| |         `-- tweetnacl@0.14.3 
| `-- yeoman-generator@0.19.2
|   +-- download@4.4.3
|   | +-- gulp-decompress@1.2.0
|   | | `-- gulp-util@3.0.7
|   | |   `-- fancy-log@1.2.0
|   | |     `-- chalk@1.1.3 
|   | `-- vinyl-fs@2.4.2
|   |   +-- glob-stream@5.3.2
|   |   | `-- micromatch@2.3.7
|   |   |   `-- object.omit@2.0.0
|   |   |     `-- for-own@0.1.4 
|   |   |       `-- for-in@0.1.5 
|   |   `-- lodash.isequal@4.1.2 
|   `-- gruntfile-editor@1.2.0 
|     +-- ast-query@1.2.0
|     | `-- lodash@4.6.1 
|     `-- lodash@4.6.1 
`-- yo@1.7.0 
  +-- chalk@1.1.3 
  | `-- ansi-styles@2.2.1 
  `-- insight@0.7.0
    `-- request@2.69.0
      `-- http-signature@1.1.1
        `-- sshpk@1.7.4
          `-- tweetnacl@0.14.3 

Running yo

anoop@anoop-vostro-3550:~/nodejs/workshop/fsbs$ yo
? 'Allo Anoop! What would you like to do? (Use arrow keys)
  Run a generator
❯ Angular 
  Express Angular 
  Ionic 
  Mobileangularui 
  Webapp 
  Karma 
chrisdwheatley commented 8 years ago

I'm not entirely sure but it looks like if you've installed the generator with sudo and the try running yo command without it then you don't have permission to use the generator. You don't need sudo to install modules globally. Some resources which may help you out:

ghost commented 8 years ago

Sorry with delayed post, my modem was under repair :)

These are some warnings that are displayed when installing:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.