joyent/node — Issue #2656: fs.renameSync throws exception
Author: DiogoNeves
Created: 2012-02-01 01:44:29+00:00
State: open

I'm not entirely sure if renameSync is deprecated or not but it throws:

node.js:218
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOENT, no such file or directory 'path/that/exists/file'
at Object.renameSync (fs.js:345:18)
at /.../nodedebug/error_msgs/test-sync.js:6:6
at Object. (/.../nodedebug/error_msgs/test-sync.js:9:2)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:32)
at Function._load (module.js:310:12)
at Array.0 (module.js:484:10)
at EventEmitter._tickCallback (node.js:209:41)

and my test file is:

``` javascript
(function () {
"use strict";

var fs = require("fs");

fs.renameSync("path/that/exists/file", "path/that/doesntexist/file", function (err) {
console.log(err);
});
}());
```

Cheers