Error: EPERM: operation not permitted, unlink

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啦

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 描述 npm从以下来源获取配置值,按优先级排序: 命令行标记 在命令行上放置--foo bar设置foo配置参数为...
    竹天亮阅读 44,307评论 0 8
  • NPM依赖包版本号~和^和*的区别: ~ 会匹配最近的小版本依赖包,比如~1.2.3会匹配所有1.2.x版本,但是...
    宋song一阅读 4,693评论 0 0
  • npm是什么 NPM的全称是Node Package Manager,是随同NodeJS一起安装的包管理和分发工具...
    build1024阅读 12,411评论 0 9
  • 报错——operation not permitted(没有许可证) 【原因】npm的版本过高,导致一些依赖包下载...
    简小园阅读 42,587评论 2 6
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 13,793评论 1 32