Node-fs-extra: illegal operation on a directory, unlink

Created on 24 Aug 2017  路  1Comment  路  Source: jprichardson/node-fs-extra

I am getting following error while using copySync method

Error: EISDIR: illegal operation on a directory, unlink '/path/to/dest'
    at Object.fs.unlinkSync (fs.js:1081:18)
    at copyFileSync (/path/to/project/node_modules/fs-extra/lib/copy-sync/copy-file-sync.js:15:10)
    at Object.copySync (/path/to/project/node_modules/fs-extra/lib/copy-sync/copy-sync.js:43:5)
    at fs.ensureDir.err (/path/to/code.js:21:5)
    at xfs.mkdir.er (/path/to/project/node_modules/fs-extra/lib/mkdirs/mkdirs.js:37:14)
    at FSReqWrap.oncomplete (fs.js:114:15)

Most helpful comment

@akshaykumar12527 You're attempting to copy to a destination that already exists as a directory (/path/to/dest is a directory). That's why you're getting an error.

>All comments

@akshaykumar12527 You're attempting to copy to a destination that already exists as a directory (/path/to/dest is a directory). That's why you're getting an error.

Was this page helpful?
0 / 5 - 0 ratings