Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: "EISDIR: illegal operation on a directory, realpath" error on RA… #13655

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,17 @@ function optimizeSafeRealPathSync() {
safeRealpathSync = fs.realpathSync
return
}

// Check the availability `fs.realpathSync.native`
// in Windows virtual and RAM disks that bypass the Volume Mount Manager, in programs such as imDisk
// get the error EISDIR: illegal operation on a directory
try {
fs.realpathSync.native(path.resolve('./'))
} catch (error) {
if (~error.message.indexOf('EISDIR: illegal operation on a directory')) {
patak-dev marked this conversation as resolved.
Show resolved Hide resolved
safeRealpathSync = fs.realpathSync
return
}
}
exec('net use', (error, stdout) => {
if (error) return
const lines = stdout.split('\n')
Expand Down