Why does npm always make mistakes when installing grunt, yeoman and other packages?

  node.js, question

Xiao Bai didn’t quite understand it, and posted a command line for help!

npm ERR!  tar.unpack untar error /Users/xuliang/.npm/grunt-cli/0.1.13/package.tgz
 npm ERR!  Darwin 14.0.0
 npm ERR!  argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
 npm ERR!  node v0.12.0
 npm ERR!  npm  v2.5.1
 npm ERR!  path /usr/local/lib/node_modules/grunt-cli
 npm ERR!  code EACCES
 npm ERR!  errno -13
 
 npm ERR!  Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
 npm ERR!  at Error (native)
 npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli']
 npm ERR!  errno: -13,
 npm ERR!  code: 'EACCES',
 npm ERR!  path: '/usr/local/lib/node_modules/grunt-cli',
 npm ERR!  fstream_type: 'Directory',
 npm ERR!  fstream_path: '/usr/local/lib/node_modules/grunt-cli',
 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:46:53',
 npm ERR!  'FSReqWrap.oncomplete (fs.js:99:15)' ] }
 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/xuliang/npm-debug.log

Look at log.Please try running this command again as root/Administrator.
The solution is given upstairs. Add before the commandsudoFull stop

In addition, you can have a look.http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudoHere