0

I'm attempting to create my first Yeoman webapp using the webapp generator. However I get the following errors:

npm http GET https://registry.npmjs.org/generator-webapp
npm http 304 https://registry.npmjs.org/generator-webapp
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/generator-webapp'
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/generator-webapp']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/generator-webapp',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/generator-webapp',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack:
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR!      'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "generator-webapp"
npm ERR! cwd /Users/jonmacbook/Desktop/yeoman-demo
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! path /usr/local/lib/node_modules/generator-webapp
npm ERR! fstream_path /usr/local/lib/node_modules/generator-webapp
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/generator-webapp'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jonmacbook/Desktop/yeoman-demo/npm-debug.log
npm ERR! not ok code 0


I just installed your generator by running:

    npm install -g generator-webapp

I am pretty sure that node js and yeoman were installed ok. Is there a permissions issue or path issue?

Jonathan Beech
  • 509
  • 1
  • 6
  • 16
  • Did you try to run this command again as root/Administrator? – Tobino Dec 29 '13 at 15:31
  • @Tobino Thanks for the help. I used some of the information that was supplied in this post to help with this issue.http://stackoverflow.com/questions/18212175/npm-yo-keeps-asking-for-sudo-permission As you correctly identified, the command needed running as an Administrator – Jonathan Beech Dec 30 '13 at 19:17

2 Answers2

1

I thought I was crazy but a lot of people were having the same problem as me.

This may or may not be the right answer for you but, for me it was do a fresh install of node/npm. I really didn't want to because it sounded like opening a can of worms but it's not as bad as it sounds. Within 15 minutes all my Yeoman generators are working and my permissions are good.

@Dominic Tancredi lays it out nicely, and then just see through using NVM to install fresh node. https://stackoverflow.com/a/11178106/1118070

Community
  • 1
  • 1
Ryan Ore
  • 1,315
  • 17
  • 23
0

We have the same error, I fixed this by changing the user owner by

chown my_username:my_username ~/.config/configstore/update-notifier-yo.yml

then after that, another error occurred,

npm ERR! stack Error: EACCES, open /home/my_username/.npm/chalk/0.4.0/package/package.json

then change again the owner of ~/.npm directory.

then solved the problem. Hope it will helpful.