r-darwish / topgrade

Upgrade everything
GNU General Public License v3.0
3.36k stars 160 forks source link

pnpm fails after installing nvm #870

Closed ahusby closed 2 years ago

ahusby commented 2 years ago

I'm not sure if this counts as a bug. It's not a big problem, and I think I found a solution. I love topgrade to a large degree because it Just Works out of the box. In this case it didn't and I had to start thinking and searching the web to try to find a way to run topgrade without errors.

What did you expect to happen?

Should be able to run topgrade -v without errors, and in this particular case have all Javascript package management tools be upgraded without errors.

What actually happened?

Lots of stuff updates fine as usual, but updating of the tool pnpm fails with following output.

―― 10:54:25 - Performant Node Package Manager ――――――――――――――――――――――――――――――――――
 2022-03-08T09:54:25.343Z DEBUG topgrade::utils      > Detected "/home/areh/.nvm/versions/node/v16.14.0/bin/npm" as "npm"
 2022-03-08T09:54:25.584Z TRACE topgrade::executor   > Output of "/home/areh/.nvm/versions/node/v16.14.0/bin/npm" "root" "-g": Output { status: ExitStatus(ExitStatus(0)), stdout: "/home/areh/.nvm/versions/node/v16.14.0/lib/node_modules\n", stderr: "" }
 2022-03-08T09:54:25.585Z DEBUG topgrade::executor   > Running "/home/areh/.nvm/versions/node/v16.14.0/bin/pnpm" "update" "-g"
 ERROR  No package.json found
 2022-03-08T09:54:25.913Z DEBUG topgrade::runner     > Step "pnpm" failed: exit status: 1
 2022-03-08T09:54:25.913Z DEBUG topgrade::terminal   > Desktop notification: pnpm failed

Additional details

The issue occured on my first attempt to run topgrade after I uninstalled npm which I had installed via brew for Linux. I then reinstalled npm by way of installing nvm with their recommended command curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash and then running nvm install --lts. I don't think topgrade ever tried to upgrade pnpm before I installed nvm, so I'm guessing I neved had pnpm installed at all before, and that it came with the installation of nvm.

I found a way to run topgrade without errors: I ran pnpm add -g pnpm as described in the pnpm documentation. I no longer get the error from topgrade described above.

Versions in use after all steps above:

Paste the output of `topgrade -v`
r-darwish commented 2 years ago

I'm not really sure what Topgrade needs to do here, especially if the problem is resolve one you upgrade pnpm

ahusby commented 2 years ago

I'm not really sure what Topgrade needs to do here, especially if the problem is resolve one you upgrade pnpm

Yeah, I don't want to waste anybody's time. I run topgrade almost daily without this (or any other) issue now, so for me it's ok if you close this issue. Only I wonder if the five :+1: this issue got is because other people are bothered by this....