Skip to content
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

uninstall pnpm? #1033

Closed
tomByrer opened this issue Feb 7, 2018 · 25 comments
Closed

uninstall pnpm? #1033

tomByrer opened this issue Feb 7, 2018 · 25 comments

Comments

@tomByrer
Copy link

tomByrer commented Feb 7, 2018

Hard to Google 'uninstall pnpm' when pnpm uninstall is a command ;)

I curl -L https://unpkg.com/@pnpm/self-installer | node, & am unsure how to undo that & remove the cache.

@zkochan
Copy link
Member

zkochan commented Feb 7, 2018

We can add such command to @pnpm/self-installer but as of now you can uninstall pnpm only manually

Here's the destination where it is unpacked:

https://github.com/pnpm/self-installer/blob/93903e8bfa0e5b2cad5ab90ab517d0400285288e/src/install.js#L7

@deadcoder0904
Copy link
Contributor

deadcoder0904 commented Feb 16, 2018

Yes I need it too.

How do we uninstall pnpm while removing all the packages in the global store?

Will npm r -g pnpm && rm -rf ~/.pnpm-store remove all packages?

Edit:

I tried npm r -g pnpm && rm -rf ~/.pnpm-store & installed pnpm & ran it through my project but it reused all the modules which means it had packages in my project drive & not home ~/.

So how do we clear entire store? Maybe a command like pnpm cache clean can remove everything from the global store.

Edit 2:

As Zoltan earlier told me few months back in some issue that pnpm installs store in the root of every drive. Its a feature released in some version of pnpm.

So in my case, it got installed in another drive than my root drive & it was 1.5GB & to clear it I had to do rm -rf /Volumes/<drive-name>/.pnpm-store for MacOS.

Anyways an option like this would be nice like pnpm cache clean clears all pnpm packages if you want to start fresh.

Also, after uninstalling pnpm it should remove all the packages from ~/.pnpm-store.

@smplyjr
Copy link

smplyjr commented Nov 11, 2019

I'm having the issue right now, any fixes?

Operating System: Win 7 (64-bit)
PNPM Version: 4.1.8

Steps that I made so far to uninstall:

  • Open command prompt and run npm uninstall pnpm -g
  • Open command prompt as an admin and run npm uninstall pnpm -g

Actual result: when running pnpm from command prompt, it still returns the configuration of pnpm.

Expected result: when running pnpm from command prompt, it should return pnpm is not recognized as an internal etc... (YOU GET THE IDEA SINCE IT IS COMPLETELY UNINSTALLED/REMOVED)

Note: I run npm list -g -depth 0 as well and pnpm is not listed there but by running pnpm from the command prompt, it still shows the configuration files.

@Countrygrl00
Copy link

I'm having the issue right now, any fixes?

Operating System: Win 7 (64-bit)
PNPM Version: 4.1.8

Steps that I made so far to uninstall:

  • Open command prompt and run npm uninstall pnpm -g
  • Open command prompt as an admin and run npm uninstall pnpm -g

Actual result: when running pnpm from command prompt, it still returns the configuration of pnpm.

Expected result: when running pnpm from command prompt, it should return pnpm is not recognized as an internal etc... (YOU GET THE IDEA SINCE IT IS COMPLETELY UNINSTALLED/REMOVED)

Note: I run npm list -g -depth 0 as well and pnpm is not listed there but by running pnpm from the command prompt, it still shows the configuration files.

@beganovich
Copy link

beganovich commented Feb 21, 2020

Had an issue today, was terrible experience looking for the solution, when uninstall do something totally different.

However, this is my approach (note: this only applies to Linux, haven't tested on Mac/Windows & pnpm was installed using npm):

  1. See if the pnpm is listed on global list of modules: npm list -g -depth 0
  2. Even though, I installed it with npm it wasn't there, so let's add it again: sudo npm add -g pnpm --force

Note: --force is provided because pnpm binary was already there.

  1. Remove the store, for me it was in: sudo rm -rf ~/.pnpm-store
  2. Remove the module itself: sudo npm uninstall -g pnpm

Note:
I am using sudo because I don't use nvm. If you are nvm user you probably won't need it.

@luxlogica
Copy link

@zkochan Feature request: could we have a pnpm self-uninstall command - or something similar?

After all, pnpm knows where al of its files and stores are, and is in the best position to uninstall itself. I think it would also help those who are new or hesitant to try it out - it's reassuring when you know that you can always try things out and then clean it all off your system with one command, if you don't like it.

@zkochan zkochan mentioned this issue Jan 2, 2021
@retorquere
Copy link

I have followed the various instructions above, and I'm getting

Error: Cannot find module '/Users/emile/.npm-packages/pnpm-global/4/node_modules/mocha/bin/mocha'

when I'm trying to run a globally-installed mocha. I've removed all of node and reinstalled it, and I can't find any environment variable or dot-file that still points to pnpm.

@zkochan
Copy link
Member

zkochan commented Mar 30, 2021

Try to run npx pnpm rm -g mocha

@Yaojian
Copy link

Yaojian commented Apr 9, 2021

After removing ~/.pnpm-store and reinstall pnpm using npm install -g pnpm, now pnpm gets error when running pnpm install in a project:

 ERROR  ENOENT: no such file or directory, open '/home/jyao/.pnpm-store/v3/files/9b/9366257cffcc47db42b9d0203bb592c13c0298-index.json'

any ideas?

@zkochan
Copy link
Member

zkochan commented Apr 9, 2021

@Yaojian I am not sure how would that happen. Do you use the offline setting?

@Yaojian
Copy link

Yaojian commented Apr 9, 2021

This is the whole story:

  1. I use pnpm install on a project and got lots of ERR_PNPM_FETCH_404 with registry.npmjs.org, such as
     Scope: all 3 workspace projects
      WARN  GET https://registry.npmjs.org/@swc/core/download/@swc/core-1.2.50.tgz error (ERR_PNPM_FETCH_404). Will retry in 
     10 seconds. 2 retries left.
      WARN  GET https://registry.npmjs.org/@graphql-codegen/typescript-react-apollo/download/@graphql-codegen/typescript- 
      react-apollo-2.2.3.tgz error (ERR_PNPM_FETCH_404). Will retry in 10 seconds. 2 retries left.
    

  ```
2. I tried to install pnpm from a different npm mirror and still got some ERR_PNPM_FETCH_404
3. I tried to reinstall pnpm with a fresh store, so I deleted `/.pnpm-state.json` and `/.pnpm-store`
4. install pnpm using `npm install -g pnpm`
5. execute `pnpm install` under my project cause the above error

Is there a way to fully uninstall pnpm or reset the store?

@zkochan
Copy link
Member

zkochan commented Apr 9, 2021

You did fully remove the store. The seems unrelated to removing pnpm. Does it also happen with pnpm v5?

@Yaojian
Copy link

Yaojian commented Apr 9, 2021

Its pnpm 6.0.1

@isc30
Copy link

isc30 commented Jun 10, 2021

same issue here

@zkochan
Copy link
Member

zkochan commented Jun 13, 2021

I documented how pnpm may be removed from the system: https://pnpm.io/uninstall

There is not a single command currently. There are some manual steps.

Please create new issues for unrelated things like issues with the global store.

@sayantan300
Copy link

Just realised that pnpm also saves node modules in another folder...
I just tried pnpm but I don't think it's good for me because it downloads packages parallely, which eats up more ram than npm i, making my device nearly unusable. Even my terminal and system freezed up at one point.
So I decided to remove pnpm. Did npm un -g pnpm and it deleted pnpm. I also deleted the folder and file told above. But still I saw there was no decrease in my storage... Then I just checked the size of node modules in my repo in which I had tried pnpm i, and it was doubled... Then I just looked inside node modules and found pnpm stored nearly all packages in .pnpm folder. Deleting it cleared half of the node modules and my storage went back before I has installed pnpm.
So why is .pnpm folder there inside node modules if pnpm was meant to be a global package manager?

@zkochan
Copy link
Member

zkochan commented Jul 20, 2021

it downloads packages parallely, which eats up more ram than npm i

You may reduce the number of parallel network requests using the network-concurrency setting.

So why is .pnpm folder there inside node modules if pnpm was meant to be a global package manager?

The files inside node_modules/.pnpm are hard links to the global content-addressable store.

@sayantan300
Copy link

The global folder was in kbs, whereas .pnpm folder inside node modules was 300mb, please explain why is it the opposite?

@zkochan
Copy link
Member

zkochan commented Jul 21, 2021

You probably looked into the wrong directory, to find that global content-addressable store, run pnpm store path in your project. If you used pnpm only for one project, the size will be roughly equal.

@retorquere
Copy link

That's the downside of using hard links. There isn't an "actual location" of the package files, they're all just pointers to the same disk storage, and you need to remove all of them in every place they're used before their storage gets released.

@funlennysub
Copy link

I installed pnpm using Node.js is not preinstalled method for pwsh and i want to uninstall pnpm which was installed via this script but none of the commands i tried work(pnpm rm -g pnpm; npm rm -g pnpm etc)

@zkochan
Copy link
Member

zkochan commented May 7, 2022

The uninstall process is not fully automatic.

But it is well described on this page: https://pnpm.io/uninstall

@zkochan zkochan closed this as completed May 7, 2022
@benediktms
Copy link

I'm also having issues removing pnpm when using fnm. Seems I followed all the steps to remove pnpm but it seems like everytime I update my system pnpm (if I run npm update -g) 'magically' reinstalls itself?

@alikleit
Copy link

alikleit commented May 23, 2023

I had to uninstall node then re-install back again. Then install pnpm using npm by running npm rm -g pnpm in powershell.

@swalker326
Copy link

Ran into this problem today here are the steps I took:

  1. which pnpm -> /opt/homebrew/bin/pnpm. What was super weird here is when I ran brew remove pnpm It acted as if it ran and all was good, but running pnpm -v I was still seeing the version of pnpm.
  2. rm /opt/homebrew/bin/pnpm
  3. remove symlinks find /opt/homebrew/bin -type l -name 'pnpm' -delete
  4. brew update
  5. brew doctor

This got to back to no pnpm on my system, I still have not figured out a great way to manage multiple version of pnpm and package I work on wants a very specific version of pnpm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests