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
Can't upgrade pnpm version: EPERM: operation not permitted, unlink AppData\Local\pnpm\pnpm.EXE
#5700
Comments
Same here with Win11 and Node v16.15.0 |
Have you tried to run your terminal with admin permissions? |
Yes and it didn't change anything. Let me know if you need me to provide more details about my env or to do some more testing. |
Yes I did that, same error. |
I have the same problem. Is there any temporary solution? |
Does the standalone script work to reinstall pnpm? |
@zkochan yes that worked. 🎉 Does that mean that we have to open powershell and run: iwr https://get.pnpm.io/install.ps1 -useb | iex in order to upgrade pnpm? Because even on the latest version, the issue still persists: |
I think |
@zkochan please see my updated comment above! I updated it while you were adding the comment above |
Same problem 😢 |
This issue also broke updating other packages:
In the end I had to delete all C:\Users\micro\AppData\Local\pnpm* directories and reinstall from there. |
This issue still exists in 7.25.1 (Win 10 Home 21H2):
|
Some time has passed and pnpm has been updated to v8. Is there any progress on this issue? I'm having the same problem on Windows 10. |
This is a common issue on windows in my experience, with a number of different services, though for me its normally I would suggest hitting Ctrl + Shift + Esc and finding the running process, in this case its likely I hope this helps. |
@luke-hagar-sp but if you're using pnpm to update itself with the suggested command This used to work, whereas now it seems to always (or usually?) fail with an EPERM error. |
I ran into the same problem. After I encountered a strange problem I reinstalled pnpm using the following command
Then I installed the latest pnpm@8.6.10 But when I use it, this problem occurs. When I execute |
@amihhs That is a permission problem. Files on Windows are locked on use. So that explains why renaming pnpm.exe for another name works. But why its been blocked doesn't make sense. |
@adelarsq This problem is caused by the existence of an old version of pnpm and installing |
If anyone is still having issue with this problem, might I suggest running |
@thakyZ I don't have pnpm.cmd, just npm.cmd, is that what you meant? Either way, I've switched to using winget to manage pnpm versions and so far it's worked flawlessly. |
@Deebster I had the path to I installed pnpm thought npm and then just ran into the issue recently. I was just leaving it as a fix if it may be an alternative fix for anyone else, since I didn't see it covered or mentioned. |
I still have this error after installing $ pnpm --version
8.6.12
$ pnpm add -g pnpm
Nothing to stop. No server is running for the store at C:\Users\foobar\AppData\Local\pnpm\store\v3
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 0, done
WARN The target bin directory already contains an exe called pnpm, so removing C:\Users\foobar\AppData\Local\pnpm\pnpm.EXE
EPERM EPERM: operation not permitted, unlink 'C:\Users\foobar\AppData\Local\pnpm\pnpm.EXE' |
solved the issue for me! thanks |
I believe due to admin rights restriction on my machine, I installed pnpm using |
fixed this problem after running |
This sadly changed nothing. |
Still no update? |
I can repro |
After the update to 8.12 I ran into this issue. I was getting "operation not permitted, unlink 'C:***\Local\pnpm\pnpm.EXE' ". I was able to work around this by renaming the 8.11 pnpm.exe file to "old-pnpm.exe", then ran I deleted the old .exe file and it seems to be fine for now, but I haven't restarted my PC yet so I'll find out once I do. |
I ran into this issue with an install via Powershell:
I deleted that install and installed via npm instead
And the repro went away. |
Like @huntermasonb, That's also the only thing that worked for me. |
TL;DR: I investigated this issue a little bit, because i wanted to use pnpm on Windows to manage my Node Version.
If pnpm is installed as described in 1. you can not update pnpm with pnpm. If you execute If pnpm is installed as described with 2. you can update pnpm by running My proposal for a solution would be to create a special case for the node.exe and pnpm.exe files. I would like to hear feedback on this idea. Is there a better way to solve this chicken and egg problem? |
Perhaps having a separate executable that is called by pnpm.exe as the final step that is fed the location of the new pnpm binary and watches for the current pnpm process to be terminated; at that point, the pnpm.exe binary is not locked by Windows running it and should be able to be deleted. Alternatively, the pnpm.exe binary could detect when pnpm is supposed to update and then invoke the JS version of the binary to update pnpm.exe. This requires, however, that the JS is installed and executed separately from the pnpm.exe binary. At the same time, using that alternative executable (in this case in JS) could be used to unlink/delete/replace the pnpm.exe binary. |
Having the separate binary be JS does not work for pnpm-managed node, however. That runs afoul of node trying to overwrite itself, which Windows wouldn't like. Consequently, a separate native-code binary might be best so that it doesn't conflict with the open node or pnpm processes. |
pnpm version: 7.16.1
Code to reproduce the issue:
I have only installed pnpm in my Windows 11 laptop because I want to manage node.js versions with it.
When I install dependencies in a project, I get an warning to upgrade pnpm to a newer version by running
Expected behavior:
Normally that command should work.
Actual behavior:
After running that command I get:
The same happens with:
Additional information:
node -v
prints: v18.12.1The text was updated successfully, but these errors were encountered: