-
Notifications
You must be signed in to change notification settings - Fork 37
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
Permission Denied Error when Trying to Create Directory in Root of D Drive #20
Comments
What was the exact command line you used? Can you provide more details? The way that output files are written, is that they are first written to a temporary directory, and then a It may be that there is a problem writing to the temporary directory, or , to the target location. The write operation also creates any directory needed to open the target file. For example, if you specify I need more information.. |
C:\Users\Sunda>"C:\ProgramData\node-v18.17.0-win-x64\echogarden.cmd" align "D:\测 试\文稿分割.m4a" D:\文稿匹配.txt D:\文稿匹配文稿匹配.srt --subtitles.maxLineCount=1 --subtitles.maxLineWidth=20 --plainText.paragraphBreaks=single Prepare for alignment.. 170.9ms Writing output files.. Error: EPERM: operation not permitted, mkdir 'D:' |
Thanks for reporting. I was able to reproduce this. This happens when the target directory to write a file is the root directory of a drive. Before I write the file, I call For now you can just use some directory as the target like I'll get the fix up soon. |
Turns out that working around the issue with I found a serious bug in the I isolated a simple test case: import { move } from "fs-extra"
console.log("Moving..")
await move("D:\\test\\test.txt", "D:\\test.txt")
console.log("Done") It hangs forever (stuck at "Moving.."). Debugging into the code shows that it gets stuck in some sort of a loop trying to fix file permissions. I've opened an issue on the It's incredible that something as obvious as this hasn't been reported yet. This library had 86,665,872 downloads in the last week and has 9,000 stars. In the meantime (whatever time it'll take them to fix it), I'll have to work around this bug for this particular special case. Thanks for the feedback, you've actually found a significant bug in an external library! (also, I found a small issue with building of temporary paths.. which is now fixed) Update: I submitted a second bug report on the |
Isn't that incredible that no one has reported such simple error cases? (there have been more than 1000 issues reported in the past) The reason may be that it is rare that files are written to root directories. Node.js is a platform that is mostly used for server applications, not command line applications (although, as you can see, it turns out it can be very effective for CLIs). When a developer encounters this kind of write permission error, they usually "blame themselves" and simply avoid it by writing to a non-root path instead. However, here I'm trying to build a "fool-proof" tool where the user can specify arbitrary paths on the drive, including even the root paths (which does make sense if the drive isn't a system drive). Anyway, even trying to workaround this problem, I'm getting into serious permission errors with other methods as well, now with I'm working this out with several chatbots to try to come up with solutions that don't require administrator permissions. I'm not sure if I'll succeed at all. |
The problem doesn't happen on the root directory of all drives, only drives where the root directory doesn't have write permissions for non-administrator users (or the user Node.js uses, in general). Based on GPT-4, it's likely that Node.js is running on a different user than what you experience in the windows explorer (where likely you're using a user with Administrator privileges), and it simply doesn't have permission to write in the root folder of It may be fixed on Windows by adding permissions for non-administrator users on the root directory (haven't fully tested it, since takes too much time to run for me, asit goes recursively to all subdirectories): Anyway, after spending about 4 hours on this, at least I got some bug reports to the I did actually make some modifications to catch these kind of situations better, and prevent hangs when calling |
I believe this was resolved. Closing. |
Here's the error message that I received:
Writing output files.. Error: EPERM: operation not permitted, mkdir 'D:'
The text was updated successfully, but these errors were encountered: