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
Yarn global packages installed in incorrect directory on Windows #3055
Comments
Wasn't this fixed sometime back?
|
You have to run this command as amministrator on windows systems |
There's a known bug at the moment where we're trying to install global packages into the Node.js directory rather than Yarn's AppData directory. |
Npm I -g doesn't require admin privileges, why should yarn.
If this is a temporary fix for a known bug, then it's fine 🙂
|
That's because yarn is trying to install the link to the package inside /Program Files/ and in windows you need admin privileges to write in this folder:
|
Well, I understand the technical reason why it's asking now 🙂.
What I meant was why could it not be done without putting a file in program
files. I believe npm puts it in %appdata% or thereabouts which doesn't need
admin privileges.
|
Yes, that's the bug. It's not supposed to put the packages in Program Files. It's supposed to put them in LocalAppData. |
I was getting the same issue on Windows 10 |
If anyone wants to investigate this, pull requests are always appreciated! It just sounds like whatever code determines the directory for global packages is incorrectly returning the Program Files directory. |
Luke123443 is correct, That's because yarn is trying to install the link to the package inside /Program Files/ and in windows you need admin privileges to write in this folder: "EPERM: operation not permitted, open 'C:\Program Files\nodejs |
I tried the last couple of hours to migrate from npm, but I give up: every successful workaround leads to a new permission error on another file. I'm not complaining since my current programming level doesn't allow me to contribute and help solving the issue. I could move to Ubuntu, so staying on Windows is my personal choice and there are consequences I must live with. However, I still wonder: isn't basically every Windows likely to meet this issue? Can it reasonably be said that yarn supports Windows since the bug is around since last October? If it's bleeding edge, half-skilled amateur dev like me could maybe be warned to stay away for now. |
Submitted a diff to fix this: #3233
The bug only affects global packages, which are very rarely used compared to regular (local) packages. The only use case for global packages is for things that are not specific to one project (for example, scaffolding tools like |
By the way, I found a workaround that worked on my pc: use chocolatey to install yarn (as proposed on the yarn website). |
Do you want to request a feature or report a bug?
bug (regression?)
What is the current behavior?
yarn add global fails with
EPERM: operation not permitted
If the current behavior is a bug, please provide the steps to reproduce.
yarn init
and thenyarn global add codeceptjs
What is the expected behavior?
same as
npm -g install codeceptjs
i.e. install the package globally without errorsPlease mention your node.js, yarn and operating system version.
nodejs v7.8
yarn v0.22.0
windows 10 pro x64
Stacktrace:
yarn error log:
https://gist.github.com/dheerajbhaskar/07cdc55e1d80282c4782f948638fa7c4
The text was updated successfully, but these errors were encountered: