resolve
resolve copied to clipboard
Fix "illegal operation on a directory, realpath" on RAM Disk
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'.
For the fix, fs.realpath.native()
will fallback to fs.realpath()
if errno is illegal operation(-4068).
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 promise APIs don't do the trick, EISDIR still occurred
@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.
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 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
.
you can use osfmount and mount as physical drive and it works out of the box.