node.js fs.rename() error enoent node.js fs.rename() error enoent express express

node.js fs.rename() error enoent


You are accessing an unexisting file - because a path does not.

Try edit path:
change "F\myproject\1b2" to "F:/myproject/1b2" or "F:\myproject\1b2"

If doesn't work, use: (__dirname will make a path relative to the script)
__dirname + "/../../myproject\1b2"

For debugging:
Try read this file (if you get same error - it means that path is bad and rename is fine)


To avoid slash issue, you can use path.sep so it will handle the slash \ based on the OS.