[英]fs-extra: Error: EPERM: operation not permitted, unlink
I am receiving the following error using fs-extra : 我使用fs-extra收到以下错误:
ERROR { [Error: EPERM: operation not permitted, unlink 'C:\\Projects\\xxx\\branches\\xxx\\release'] errno: -4048, code: 'EPERM', syscall: 'unlink', path: 'C:\\Projects\\xxx\\branches\\xxx\\release' }
错误{[错误:EPERM:不允许操作,取消链接'C:\\ Projects \\ xxx \\ branches \\ xxx \\ release']错误号:-4048,代码:“ EPERM”,系统调用:“取消链接”,路径:“ C:\\项目\\ xxx \\分支\\ xxx \\发布'}
When using this code in my node application: 在我的节点应用程序中使用此代码时:
const fse = require('fs-extra');
fse.copySync('../util/various/a.html', '../release');
fse.copySync('../util/various/b.html', '../release');
I would like to know, what could cause the error and how to fix it. 我想知道什么会导致该错误以及如何解决该错误。
fs-extra doesn't support copying a file to a directory. fs-extra不支持将文件复制到目录。
This will work: 这将起作用:
const fse = require('fs-extra');
fse.copySync('../util/various/a.html', '../release/a.html');
fse.copySync('../util/various/b.html', '../release/b.html');
This is as-designed ( https://github.com/jprichardson/node-fs-extra/issues/320 ) although I am here because I ran into the same issue. 这是设计好的( https://github.com/jprichardson/node-fs-extra/issues/320 ),尽管我在这里是因为遇到同样的问题。
由于文件的权限,该模块无法删除目标文件(只读)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.