快捷导航

fs.renameSync出错

{ [Error: EPERM: operation not permitted, rename 'H:
elease\web\20170807173153' -> 'H:\GameProject\G2_Rab
  errno: -4048,
  code: 'EPERM',
  syscall: 'rename',
  path: 'H:\\GameProject\\G2_Rab\\client\\release\\w
  dest: 'H:\\GameProject\\G2_Rab\\client\\release\\p
fs.js:763
  return binding.rmdir(pathModule._makeLong(path));


这是日志文件
var indexStr = fs.readFileSync("./template/index.html", {"encoding": "utf8"});
    indexStr = indexStr.replace(/\$\{NAME}/g, NAME);
    indexStr = indexStr.replace(/\$\{PLATFORM}/g, PLATFORM);
    indexStr = indexStr.replace(/\$\{SDK_URL}/g, SDK_URL);
    indexStr = indexStr.replace(/\$\{E_VERSION}/g, E_VERSION);
    indexStr = indexStr.replace(/\$\{G_VERSION}/g, G_VERSION);
        try{
                fs.renameSync("../release/web/" + G_VERSION + "/", "../release/publish/");
        }catch(e){
                console.log(e);
        }
    fs.rmdirSync("../release/web/");
    fs.writeFileSync("../release/publish/index.html", indexStr);


    commitPublish();
这是我的JS文件


在执行这句fs.renameSync("../release/web/" + G_VERSION + "/", "../release/publish/");代码的时候出问题

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员1

将fs.renameSync(files.upload.path, “/tmp/test.png”);中的"/tmp/test.png"改为 "./tmp/test.png"也是可以的...吧?
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP