question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fs.move fails with EEXIST even when overwrite option is enabled

See original GitHub issue

It doesn’t happen all the time but sometimes I’m getting the following error message when using move() with the overwrite options:

{ Error: EEXIST: file already exists, link '/tests/fuzzing/sync/.sync/214b820bf10c4744994fb9a876e433d3.md_1498950555952' -> '/tests/fuzzing/sync/214b820bf10c4744994fb9a876e433d3.md'
    at Error (native)
  errno: -17,
  code: 'EEXIST',
  syscall: 'link',
  path: '/tests/fuzzing/sync/.sync/214b820bf10c4744994fb9a876e433d3.md_1498950555952',
  dest: '/tests/fuzzing/sync/214b820bf10c4744994fb9a876e433d3.md' }

I’m calling it like this, as a promise: fs.move(oldPath, newPath, { overwrite: true }); and most of the time it works but sometime it’s going to generate the EEXIST error. Any idea what could be the reason?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
lauredecaudincommented, Jan 26, 2018

Hi, I have the same problem with my Windows 10 VM (which is not WSL if I understand well, if not, please tell me)

1reaction
tormozz48commented, Jan 16, 2019

I think that this issue can occur while perform multiple move operation like this:

Promise.all([
    './foo/bar1',
    './foo/bar2',
    ....
    './foo/bar999'
].map((dest) => fs.move('./mySrc', dest, {override: true})));

Each of move operation include mkdirp itself and can fail on creation common root folder in concurrency mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File.Move Does Not Work - File Already Exists - Stack Overflow
Show activity on this post. According to the docs for File. Move there is no "overwrite if exists" parameter. You tried to specify...
Read more >
File.Move Method (System.IO) | Microsoft Learn
Moves a specified file to a new location, providing the options to specify a new file name and to overwrite the destination file...
Read more >
How To Work with Files using the fs Module in Node.js
Change your working directory to the newly created folder with the cd command: cd node-files. In this folder, you'll create two files. The...
Read more >
Node.js fs-extra move() Function - GeeksforGeeks
The move() function moves a file or a directory from source to the ... set the option of overwrite to true else it...
Read more >
mv: Move file only if destination does not exist
On a FreeBSD system: -n Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found