windows系统下使用node.js在使用npm安装express时报错的解决方法
安装时出现如下错误
C:\Users\admin>npm uninstall express -g
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "uninstall" "express" "-g"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path C:\Program Files\nodejs\node_cache\_locks
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_cache\_locks'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_cache\_locks'
npm ERR! at Error (native)
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_cache\\_locks' }
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\admin\npm-debug.log
重点是:operation not permitted 想到应该是windows系统下的权限错误。
解决方法: 使用win+x,选择命令提示符(管理员),在里面运行命令就好了。
参考资料:http://www.cnblogs.com/haochuang/p/5796284.html