fs.move fails with chmod error when disk under heavy use
See original GitHub issueUsing fs-extra v2.0.0 I noticed that fs.move
, which uses /lib/copy/ncp
under the hood, fails with a chmod
error when the disk is under heavy use.
{ Error: ENOENT: no such file or directory, chmod '/the/path-a/file'
errno: -2,
code: 'ENOENT',
syscall: 'chmod',
path: '/the/path-b/file' }
In this case I’m moving a very large directory of a few files.
I’m using pify on fs.move
:
const binary = (func) => (a, b) => func(a, b)
const move = binary(pify(fs.move))
// ...
move('/the/path-a', '/the/path-b')
With this error on the move operation what ends up happening is that path-a
will still exist with one or so of its files left but path-b
is created and contains all files (at least it contains a copy of the file remaining in path-a
).
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (17 by maintainers)
Top Results From Across the Web
Node fs Error: EPERM: operation not permitted, open
The issue was that the file was set to readonly (by source control). Unchecking the readonly option in the file properties fixed the...
Read more >fs-extra - npm
fs -extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.
Read more >Troubleshooting Windows Subsystem for Linux | Microsoft Learn
Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
Read more >Windows WSL Ubuntu sees wrong permissions on files in ...
I noticed the owner of the file on Windows was "Administrators". I changed that to be my user following this link and WSL...
Read more >CHANGELOG.md - ATLAS Open Data
started moving tests inline - upgraded to `jsonfile@2.1.0`, can now pass JSON ... "fs.copy fails with chmod error when disk under heavy use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jdalton fs-extra uses
fs.rename
when possible, if that’s not possible it usesncp
and deletes the source.@manidlou We don’t use node-mv as a dependency;
lib/move/index.js
is a fork of node-mv.@jdalton We don’t want to shell out to
mv
for a few reasons:child_process
is kinda slow@jdalton thanks for checking back to let us know!! Much appreciated.