resolve icon indicating copy to clipboard operation
resolve copied to clipboard

Fix "illegal operation on a directory, realpath" on RAM Disk

Open duykhang53 opened this issue 3 years ago • 6 comments

The native method of fs.realpath() cause error on RAM Disk created by imDisk.

Angular developers might get this error when running ng s on RAM Disk when they using scss in their project

From tracing in postcss-import, I got EISDIR: illegal operation on a directory, realpath 'R:\angular-project'. image

For the fix, fs.realpath.native() will fallback to fs.realpath() if errno is illegal operation(-4068).

duykhang53 avatar Sep 25 '20 12:09 duykhang53

I wonder if node can do something to improve the native realpath. The promise api uses the native implementation under the hood (https://nodejs.org/api/fs.html#fs_fspromises_realpath_path_options), so it'll probably become more prevalent

SimenB avatar Oct 03 '20 13:10 SimenB

@SimenB promise APIs don't do the trick, EISDIR still occurred

image

duykhang53 avatar Oct 03 '20 21:10 duykhang53

@duykhang53 that makes sense - it's the same API. My point was that it shouldn't be up to consumers to deal with these issues, it should be fixed upstream in Node itself.

SimenB avatar Oct 04 '20 00:10 SimenB

This issue occurred since node v6 and now it's v14. https://github.com/nodejs/node/issues/6861

I think it's better to apply a fallback rather than wait for nodejs to fix it.

Cost of calling just slightly affected the performance but that would be better to make the code run instead of throwing errors.

duykhang53 avatar Oct 04 '20 08:10 duykhang53

@duykhang53 the last comment in that issue, https://github.com/nodejs/node/issues/6861#issuecomment-233126946, suggests that the proper solution is to abandom imdisk in favor of aim_ll.

ljharb avatar Oct 05 '20 05:10 ljharb

you can use osfmount and mount as physical drive and it works out of the box.

last-Programmer avatar Sep 30 '21 18:09 last-Programmer