1

I'm getting errors when I type this in my terminal

yo angular

First yeoman asks me if I want to use Sass, I answered no. Then he asked if I want to use bootstrap, answered Yes.

Then he says that there are conflicts between files and he asks if I want to overwrite these files, I answered Yes. And then I'm getting this:

    I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.


   invoke       angular:route
   invoke           angular:controller:/usr/local/lib/node_modules/generator-angular/route/index.js
identical             app/scripts/controllers/about.js
identical             test/spec/controllers/about.js
   invoke           angular:view:/usr/local/lib/node_modules/generator-angular/route/index.js
identical             app/views/about.html
 conflict     test/karma.conf.js
? Overwrite test/karma.conf.js? (Ynaxdh) npm WARN package.json charlotteerpels@0.0.0 No description
npm WARN package.json charlotteerpels@0.0.0 No repository field.
npm WARN package.json charlotteerpels@0.0.0 No README data
npm WARN package.json karma-phantomjs-launcher@0.1.4 No README data
npm WARN prefer global jshint@2.5.11 should be installed with -g
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.34
npm ERR! npm  v2.1.17
npm ERR! path /Users/charlotteerpels/node_modules/.bin/jshint
npm ERR! code EACCES
npm ERR! errno 3

npm ERR! Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint'
npm ERR!  { [Error: EACCES, unlink '/Users/charlotteerpels/node_modules/.bin/jshint']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/charlotteerpels/node_modules/.bin/jshint' }
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!     /Users/charlotteerpels/npm-debug.log



/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89
  if ($._.isString(componentConfigFile.main)) {
                                      ^
TypeError: Cannot read property 'main' of undefined
    at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:89:39)
    at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:151:17
    at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2105:15)
    at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:3302:9)
    at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:33:7)
    at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:65:39)
    at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:352:5)
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
MBPvanCharlotte:ang-news charlotteerpels$ [?] May bower anonymously report usage statistics to improve the tool over time? (Y/n) y

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: read EIO
    at errnoException (net.js:905:11)
    at TTY.onread (net.js:559:19)
-bash: y: command not found

Does anyone has an idea how to fix this?

Thanks in advance!

Charlotte1993
  • 589
  • 4
  • 27

3 Answers3

2

Looks like a permissions issue. Are you the admin?

Try running with sudo:

sudo yo angular

Long-term you might want to try and see if changing ownership of your node_modules directory fixes the issue:

sudo chown -R `whoami` ~/node_modules

Link to similar permission issue with NPM

Community
  • 1
  • 1
Rei Mavronicolas
  • 1,387
  • 9
  • 12
  • The "ERR" messages are gone, but the TypeError: Cannot read property 'main' ... is stil there and there was no application made in my directory – Charlotte1993 Dec 25 '14 at 15:23
  • @Charlotte1993, looks like an issue while trying to install the wiredep dependency. Similar issue [here](http://stackoverflow.com/questions/23806236/cannot-read-property-main-of-undefined) and [here](https://github.com/yeoman/generator-angular/issues/565) – Rei Mavronicolas Dec 25 '14 at 15:39
  • I changed the file permissions on the directory bower in charlotteerpels/.cache/bower to all users write and read permission, I'm the only user on my Mac, so it's not a really big deal. Now I'm trying yo angular again, and he's downloading many files from github from bootstrap, so I guess it's working (or at least I'm getting further than before). Now it's "stuck" at "jquery#2.1.3 bower_components/jquery app/index.html modified." But I've been told that this is normal! I'm letting you know if it worked! – Charlotte1993 Dec 25 '14 at 15:54
0

Changing the directory permissions on the bower directory in charlotteerpels/.chmod for all users to read and write, fixed it. My app was made in the wrong directory (my home directory), but there are solutions for that.

Rei Mavronicolas
  • 1,387
  • 9
  • 12
Charlotte1993
  • 589
  • 4
  • 27
0

make sure you run

bower install

at least once. Bower asks a questions about reporting usage statistics the first time you run it and that will cause

yo angular

command to fail.

tacheshun
  • 61
  • 1
  • 6