Npm install -g express keeps reporting errors.

  node.js, question

C:\Users\xxxxx>npm install -g express
npm ERR! Windows_NT 6.1.7601
npm ERR! argv “D:\\soft\\nodejs\\node.exe” “D:\\soft\\nodejs\\node_modules\\npm\
\bin\\npm-cli.js” “install” “-g” “express”
npm ERR! node v5.7.1
npm ERR! npm v3.6.0
npm ERR! path D:\soft\nodejs\node_cache\express
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir

npm ERR! Error: EPERM: operation not permitted, mkdir ‘D:\soft\nodejs\node_cache
\express’
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, mkdir ‘D:\soft\nodejs\node_c
ache\express’]
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘mkdir’,
npm ERR! path: ‘D:\\soft\\nodejs\\node_cache\\express’ }
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! C:\Users\liudan\npm-debug.log

Obviously, it is a permissions problem, and the permissions of the npm default directory need to be changed (use chown command to make the npm directory owner the current user):

sudo chown -R $(whoami) ~/.npm

Or so

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Reference:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo