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 issue. You need to change the permissions of the npm default directory (use the chown command to change the owner of the npm directory to the current user):
Or this
Reference:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
http://stackoverflow.com/questions/16151018/npm-throws-error-without- sudo
This is a windows operating system. Just use the system administrator to run cmd and then run the command. No need to add sudo
Obviously your current user
liudan
does not have permission to createD:softnodejsnode_cacheexpress
Try creating this folder yourself, and then change the permissions in the properties
If global installation requires permissions, use sudo npm i express -g
Thank you for your guidance, the problem has been solved.