Do you want to request a feature or report a bug?
bug
What is the current behavior?
The command yarn add vue
fails with the error message
Error: EPERM: operation not permitted, open 'C:\Users\username-obfuscated\.yarnrc'
at Error (native)
If the current behavior is a bug, please provide the steps to reproduce.
yarn add vue
What is the expected behavior?
Yarn should recognize that .yarnrc exists, even if it a hidden file.
Please mention your node.js, yarn and operating system version.
Node.js version 6.11.2, yarn version 0.27.5, operating system Windows 10 Home, version 1703, build 15063.483
If we can't read this file, not sure we can't do much
I had this issue too. Manually unhiding and rehiding ~.yarnrc in Explorer fixed it for me.
Not sure, but it would almost seem like Yarn creates this file in a non-standard 'hidden' way, making it invisible or unavailable for applications.
Just want to say that I had to touch ~/.yarnrc
then hide and unhide the file like the comment above this.
Why is this closed? The issue still exists. If you hide .yarnrc every add will end with error: EPERM. This also causes creat-react-app and other bootstrappers to fail.
Why is this closed? The issue still exists
Because it's not a problem Yarn can fix as far as I know. If I'm incorrect, then a PR (that would explain in detail the problem and the resolution) will go a long way into fixing this 馃檪
@arcanis Thanks for your response, I don't know much about the yarn's internals but I was supposing this was concerning to yarn since most applications does not have problems with hidding its dot files in windows.
I don't understand why node.js developers have a mental block on this type of a problem. A hidden file is NOT a read-only file. Nor is it a non-existent file. Technically, all Unix files that start with "." are hidden. On Windows it is a separate flag, but the behavior should be the same. The file is available. Visibility settings are not the same as permissions. This is a BUG and should not have been closed.
Here is a similar issue that node itself had: https://github.com/nodejs/node/issues/5261
Only they owned the issue, called it a bug, and fixed it.
I'm willing to take a stab at this! Leaving this note here so that I can come back to it in a few days.
On Windows, opening a file in w
mode will throw EPERM
if the file has the hidden attribute. Instead, we should open the file in r+
. However, in order to do this, we need to ensure that the file exists. So, I think the easiest implementation would be to update this function to create the file if it doesn't exist, then open it in r+
mode, and the write the data to the file. Since it's using a promisified version of fs.writeFile
, we could in theory update writeFile
to have this behavior. That'll be what I'll investigate.
hi my friends , go to c:/users/{pc name}/
show hidden file
properties .yarnrc
hidden uncheck
good luck
Sorry for being slightly off-topic, but why does the yarnrc file on Windows gets saved to the user's folder instead of %APP_DATA%? If the latter would be the case, there would be in my opinion no need to manually hide the file.
Most helpful comment
I don't understand why node.js developers have a mental block on this type of a problem. A hidden file is NOT a read-only file. Nor is it a non-existent file. Technically, all Unix files that start with "." are hidden. On Windows it is a separate flag, but the behavior should be the same. The file is available. Visibility settings are not the same as permissions. This is a BUG and should not have been closed.
Here is a similar issue that node itself had: https://github.com/nodejs/node/issues/5261
Only they owned the issue, called it a bug, and fixed it.