pnpm icon indicating copy to clipboard operation
pnpm copied to clipboard

Updating pnpm kills and then "loses" my pnpm

Open trevorallred opened this issue 3 years ago • 3 comments

pnpm version:

Update available! 7.9.3 → 7.9.5

Code to reproduce the issue:

> pnpm add -g @pnpm/exe

Expected behavior:

Should install the latest version of pnpm

Actual behavior:

> pnpm add -g @pnpm/exe
Packages: +2 -2
++--
Downloading registry.npmjs.org/@pnpm/macos-arm64/7.9.5: 18.7 MB/18.7 MB, done
Progress: resolved 6, reused 0, downloaded 2, added 2, done
.pnpm/@[email protected]/node_modules/@pnpm/exe: Running preinstall script...
/Users/..../Library/pnpm/pnpm: line 13: 44289 Killed: 9               "$basedir/global/5/node_modules/@pnpm/exe/pnpm" "$@"

> pnpm i
zsh: command not found: pnpm

Additional information:

I'm going to try and fix this on my computer...maybe it's just me. But this seems really bad, so I'm posting now before I have further details.

  • node -v prints: v16.16.0
  • Windows, macOS, or Linux?: macOS Monterey 12.3

trevorallred avatar Aug 25 '22 19:08 trevorallred

I was able to reinstall and it worked.

> curl -fsSL https://get.pnpm.io/install.sh | sh -
==> Extracting pnpm binaries 7.9.5
Copying pnpm CLI from /private/var/folders/s1/bry9y_vx07ndmqrkm45jxgvw0000gn/T/tmp.SI9kfsyj/pnpm to /Users/.../Library/pnpm/pnpm
No changes to the environment were made. Everything is already up to date.
> pnpm -v
7.9.5

Feel free to close. However, I think it's strange that it killed pnpm and lost the path somehow. Rerunning the install script seems to have solved the problem even though the output says it didn't do anything.

trevorallred avatar Aug 25 '22 19:08 trevorallred

I had same problem, but reinstal did NOT work Win10, Bash

$ curl -fsSL https://get.pnpm.io/install.sh | sh -
curl: (22) The requested URL returned error: 404 
pnpm version '7.9.5' could not be found

bad network? I can hit the rest of the internet....

tomByrer avatar Aug 26 '22 09:08 tomByrer

I have hit same problem twice, very bad experience.

Every time I need to reinstall pnpm...

a1mersnow avatar Sep 19 '22 00:09 a1mersnow

Same problem here. Reinstall won't work either. Mac OS Monterey.

$ curl -fsSL https://get.pnpm.io/install.sh | sh - ==> Extracting pnpm binaries 7.12.2 Copying pnpm CLI from /private/var/folders/8k/x867mjbj08gbmh045zsv0bdc0021b8/T/tmp.WVoUGeVo/pnpm to /Users/brehuang/Library/pnpm/pnpm No changes to the environment were made. Everything is already up to date.

brendaHuang avatar Sep 30 '22 00:09 brendaHuang

I have this issue every time I update. Sometimes install from script does not fix it either and I have to delete the PNPM_HOME dir

rm -rf $PNPM_HOME

and then install

ambar-arkin avatar Nov 06 '22 09:11 ambar-arkin

Same issue here o macos 13.0.1. the @ambar-arkin deleting the PNPM_HOME did the trick. The error I was getting after trying to update it directly using the install script was something saying that a process was killed (everytime i tried running pnpm)

gilsoncav avatar Nov 24 '22 13:11 gilsoncav

  • Same issue on MacOS 12.6.1 (M1).
  • Previous updates worked alright.
  • But the one to 7.25.0 started giving me:
[1]    22940 killed     pnpm
  • Reinstall didn't work
  • rm -rf $PNPM_HOME and reinstall worked.

Izhaki avatar Jan 15 '23 23:01 Izhaki

I get the same error, after I set the virtual-store-dir as was suggested by pnpm itself. I was using store version v3 on FreeBSD 13.1 and pnpm version was 7.17.1, I think.

I ran:

pnpm config set virtual-store-dir /usr/home/peterhil/.local/share/pnpm/global/5/.pnpm

Now NOTHING works! Every pnpm command fails:

~/ pnpm store path
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '/home/peterhil/.local/share/pnpm/global/5/node_modules/pnpm/bin/pnpm.cjs'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Installation fails with the same error as tomBryer had in this reply: https://github.com/pnpm/pnpm/issues/5265#issuecomment-1228276828

peterhil avatar Jan 17 '23 18:01 peterhil

I also experience this issue on an M1 Macbook running OSX Monterey 12.6 when installing over 7.26.3 with 7.27.0 resulted in the error when trying to run pnpm; zsh: killed pnpm

rm -rf $PNPM_HOME and reinstall also worked for me. ❤️

7oque avatar Feb 15 '23 16:02 7oque

I ran into this as well on an Intel MacBook Pro - I just wanted to upgrade pnpm to the latest version (to 7.27.1), so I tried running the curl ... install.sh install script as mentioned above and was treated with the "zsh killed pnpm" error.

Removing the home directory isn't the best solution as you'd also need to reinstall any versions of Node you installed with pnpm env use --global as well as CLI packages you might have installed globally (ex: expo, ionic, etc.).

myktra avatar Feb 21 '23 13:02 myktra

I continue to run into this time to time when I upgrade - it happened again when running an upgrade from 7.30.1 to 7.30.3. No good workaround on macOS (Intel) except to kill your entire PNPM_HOME directory and reinstalling global stuff and Node as noted previously.

Is there a more stable way of upgrading via the shell script?

Next time I see a version update notice, I'll try another method that seems to be recommended:

pnpm add -g pnpm

myktra avatar Mar 25 '23 16:03 myktra

I installed pnpm with pnpm and pnpm upgrade --global sometimes causes an error and just nukes pnpm itself.

alex-kinokon avatar Sep 03 '23 17:09 alex-kinokon

My error logs:

 ~ > pnpm upgrade -g
 WARN  deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
 WARN  deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
 WARN  deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
Packages: +22 -23
++++++++++++++++++++++-----------------------
 MODULE_NOT_FOUND  Cannot find module '/Users/_/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/worker.js'

Error: Cannot find module '/Users/_/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/worker.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at MessagePort.<anonymous> (node:internal/main/worker_thread:185:26)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
Progress: resolved 776, reused 713, downloaded 17, added 1

 ✘ > pnpm upgrade -g
node:internal/modules/cjs/loader:1051
  throw err;
  ^

Error: Cannot find module '/Users/_/Library/pnpm/global/5/node_modules/pnpm/bin/pnpm.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.5.1

 ✘ > pnpm
node:internal/modules/cjs/loader:1051
  throw err;
  ^

Error: Cannot find module '/Users/_/Library/pnpm/global/5/node_modules/pnpm/bin/pnpm.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.5.1

alex-kinokon avatar Sep 15 '23 18:09 alex-kinokon

yanhao2023@yanhaodeMacBook-Pro ~ % curl -fsSL https://get.pnpm.io/install.sh | sh -
==> Downloading pnpm binaries 8.8.0
 WARN  using --force I sure hope you know what you are doing
Copying pnpm CLI from /private/var/folders/yw/0yby91_125120j3qk8_320n80000gp/T/tmp.YXjQs2RjUX/pnpm to /Users/yanhao2023/Library/pnpm/pnpm
No changes to the environment were made. Everything is already up to date.
yanhao2023@yanhaodeMacBook-Pro ~ % pnpm -v                                         
zsh: killed     pnpm -v

yanhao98 avatar Oct 09 '23 01:10 yanhao98

I started having this as well after upgrading to 8.9.2. What's a workaround solution that makes it work?

callmeberzerker avatar Oct 16 '23 07:10 callmeberzerker

I think it might be connected that after upgrading to 8.9.2, fresh pnpm install process is killed on CI. I had to downgrade it to 8.6.12 to have it working again.

kozickikarol avatar Oct 19 '23 15:10 kozickikarol

If anyone encountered following output and failed to install a version:

No changes to the environment were made. Everything is already up to date.

try to delete the shell config like .shrc which contains previous pnpm config.


In my situation, I'm installing pnpm by using following command:

wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -

after I deleted $HOME/.shrc, then I'm fine to install another version.

moontai0724 avatar Nov 14 '23 03:11 moontai0724

Should there be a file at pnpm/global/5/node_modules/pnpm/bin/pnpm.cjs? When installing via pnpm.CMD add -g pnpm a pnpm and pnpm.CMD shell scripts get created which end up being what's executed when you use the pnpm command, but if I install via powershell iwr/iex, then only a pnpm.exe is created, and nothing in the global directory, if just having the .exe is correct, then why does pnpm add -g pnpm create these other files that expect nonexistent files?

josh-hemphill avatar Dec 15 '23 20:12 josh-hemphill

workaround for zsh: killed pnpm after updating pnpm on arm macs:

codesign --force --deep --sign - ~/Library/pnpm

erkage avatar Mar 18 '24 18:03 erkage

just got the same issue on the 8.5.7 update. Had to rm -rf $PNPM_HOME and reinstall - which resolved the issue.

lorenzowritescode avatar Apr 15 '24 17:04 lorenzowritescode

I also got the same issue on 8.5.7 update. I restarted the computer and resolved it.

hui890514 avatar Apr 16 '24 09:04 hui890514