Skip to content

Commit 6bd5434

Browse files
datacutterpatak-dev
andauthoredJul 18, 2023
fix: "EISDIR: illegal operation on a directory, realpath" error on RA… (#13655)
Co-authored-by: patak <matias.capeletto@gmail.com>
1 parent 6dca41c commit 6bd5434

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎packages/vite/src/node/utils.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,17 @@ function optimizeSafeRealPathSync() {
608608
safeRealpathSync = fs.realpathSync
609609
return
610610
}
611-
611+
// Check the availability `fs.realpathSync.native`
612+
// in Windows virtual and RAM disks that bypass the Volume Mount Manager, in programs such as imDisk
613+
// get the error EISDIR: illegal operation on a directory
614+
try {
615+
fs.realpathSync.native(path.resolve('./'))
616+
} catch (error) {
617+
if (error.message.includes('EISDIR: illegal operation on a directory')) {
618+
safeRealpathSync = fs.realpathSync
619+
return
620+
}
621+
}
612622
exec('net use', (error, stdout) => {
613623
if (error) return
614624
const lines = stdout.split('\n')

0 commit comments

Comments
 (0)
Please sign in to comment.