-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Error: EPERM: operation not permitted, open 'C:\Users\username\.node_repl_history' #5261
Comments
@t0lkman as an intermediate fix, set the env variable: |
As a workaround, you can put .node_repl_history in a folder, set the folder hidden, create a symlink (with |
Maybe we should just continue if there is an error and warn in the repl? |
The problem is that the error should not occur. Just because the file is set hidden should not cause a permissions error. |
@t0lkman Few of us don't use. So can you please show the actual error stack trace or explain in detail what exactly happens? Edit: nvm. I see the title now. |
And I see this: http://stackoverflow.com/questions/2246990/how-do-i-write-to-a-hidden-file |
I think printing a warning is the best bet. If the user has been fiddling with the file, maybe they don't want Node writing to it. Or, maybe they hadn't realized, and printing a warning will help them fix it. |
@cjihrig I don't agree with you, I always hide all unnecessary system files on Windows, hidden files shouldn't be considered "read only" hence I don't need any warnings |
The file is supposed to be hidden. On POSIX systems, the file name starting On Mon, Mar 14, 2016 at 6:11 PM Colin Ihrig notifications@github.com
|
cc @nodejs/platform-windows is there some special way we should attempt to open files that might be hidden on windows? |
No, that's the problem: I don't know of any other program that has issues
|
Node.js does have checks for file availability and fails gracefully if, for example, the file is set to read-only. However, for some reason it opens and closes the file three times - first as 'a+', then as 'r', then as 'w'. The problem is the third one, where there aren't any checks anymore. Trying to open a hidden file in 'w' mode is an error in Node.js, in Python (great explanation there), in C's I can think of the following solutions:
|
This also happens on Windows 10 with node v6.2.1. |
Another workaround is to set the |
add code in the file
|
Still an issue, even with other files
|
Still an issue, Windows 10 64 bit with node v7.4.0:
|
Why is this marked as "discuss"? There's not really anything to discuss. I know no other tool with this behaviour? It is clearly simply a bug. |
From #5261 (comment) and #7005 I think this is a bug. The fix should be in the repl module. #7005 provides a potential fix but it looks stalled for CI failure. I think if someone using Windows has a fix (or can fix it by trying #5261 (comment)) they can feel free to open another PR. |
@joyeecheung yes, I have essentially dropped the ball on #7005. I agree that this is a bug which needs to be fixed, but I was unable to resolve the Windows failures on CI and could not get any real resolution on how to move forward. If you or anyone else has recommendations for resolving this on those Windows builds, I would be happy to pick the PR back up again and run with it. But without that, I am not sure what to do since I really have very little knowledge of Windows systems. |
Fixed in bb041ea |
you have to open the cmd as administrator and try again with npm install |
As a blanket statement, that is really bad advice. Please only run commands with administrator privileges or sudo if you really know what you're getting yourself into. |
@seishun So, based on what you're saying, node can't read hidden files in Windows? So we just need to leave files un-hidden? |
@alidavodii Yes. But I’m interested in getting Node to work even if the file is hidden in Windows. However, it appears as it isn’t easily possible. Oh well. |
It is possible to read hidden files. The file mode just must be set accordingly. |
@BridgeAR Even when the file mode allowed read I was getting that EPERM error. I had to unhide the file from Windows to get rid of the error. |
@imthenachoman it would be good to get further information about your OS and what code you executed to further look at that. As it stands right now, we can't do anything to improve the situation in case there's indeed a bug left (which might might be). |
@BridgeAR I am on Windows 10. But I don't think there is anything that needs to be investigated. If a file is hidden then Node can't access it. In my case I am getting the error when trying to use clasp. If the file in question is hidden (through Windows) I get the EPERM error. If the file in question is not hidden I do not get the error. I don't understand all of the technical aspects but based on what I read it sounds like because of Windows limitations, Node cannot access Windows hidden files. So I think its case closed -- unless my understanding of what I read is wrong. |
@imthenachoman ideally we'll have a consistent behavior across all operating systems. I do wonder if it's possible to handle this case transparently for users on Windows. I am not a Windows user though and can't look into it on my own. |
I don't really know/use Node.js so I don't know what to look for but if there is something you want me to try, investigate, look at, etc. I can. Like are there more verbose log files anywhere that show what Node was trying to do when it looked for that file? |
@dibakar95 you should go to yarn issue tracker, this one is for Node |
I changed the permission to the project folder and it worked for me: |
Related: libuv/libuv#3380 |
On Windows 7 for node 5.5.0 if ".node_repl_history" has hidden attribute, node fails to open.
The text was updated successfully, but these errors were encountered: