npm 安装依赖包时报错。
npm ERR! path D:\workspace\gddn-videomonitorsetting\node_modules\.staging\typescript-a56f33a2\lib\typescript.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\workspace\gddn-videomonitorsetting\node_modules\.staging\typescript-a56f33a2\lib\typescript.js'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'D:\workspace\gddn-videomonitorsetting\node_modules\.staging\typescript-a56f33a2\lib\typescript.js']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\workspace\gddn-videomonitorsetting\node_modules\.staging\typescript-a56f33a2\lib\typescript.js'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\workspace\\gddn-videomonitorsetting\\node_modules\\.staging\\typescript-a56f33a2\\lib\\typescript.js' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'D:\\workspace\\gddn-videomonitorsetting\\node_modules\\.staging\\typescript-a56f33a2\\lib\\typescript.js\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\workspace\\gddn-videomonitorsetting\\node_modules\\.staging\\typescript-a56f33a2\\lib\\typescript.js',
npm ERR! parent: 'ant-design-pro' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
operation not permitted:操作不允许
1.排除是否有权限问题,可以用管理员身份运行一下。
2.如果没有权限问题,可以在C:\Users{账户}\下的.npmrc文件. 即清除npm缓存
(也可以使用命令清除缓存 npm cache clean --force)
3.再次运行npm i: ok啦