volta icon indicating copy to clipboard operation
volta copied to clipboard

`pmpm` uses the `node` version it was installed it instead of currently active/pinned version

Open nifr opened this issue 2 years ago • 11 comments

Given volta's active node version is i.e. v20.8.1 When I install pnpm with volta And I install and pin a different node version i.e. v21.0.0 Then pnpm still uses the previous node version v20.8.1

Steps to reproduce:

volta install [email protected]
volta install [email protected]
volta install [email protected]
volta pin [email protected]
pnpm run dev

With package.json containing:

  "packageManager": "[email protected]",
  "volta": {
    "node": "21.0.0"
  },
  "engines": {
    "node": "21.0.0",
    "pnpm":"8.9.2"
  }

The following warning appears and reveals that the incorrect node version is used under the hood:

WARN  Unsupported engine: wanted: {"node":"v21.0.0"} (current: {"node":"v20.8.1","pnpm":"8.9.2"})

nifr avatar Oct 24 '23 09:10 nifr

Also hitting this with pnpm 8.9+ and volta (yes VOLTA_FEATURE_PNPM=1 is set)

runspired avatar Nov 03 '23 01:11 runspired

+1 and I cannot uninstall Node that volta installed

lananelson avatar Nov 30 '23 22:11 lananelson

I can't reproduce with steps that OP posted. I may be able to take this issue on but I need a certainly reproducible way to reproduce.

volta install [email protected]
volta install [email protected]
volta install [email protected]
volta pin [email protected]
volta pin [email protected]
pnpm run dev
{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "volta": {
    "node": "21.0.0",
    "pnpm": "8.9.2"
  }
}

chawyehsu avatar Dec 01 '23 02:12 chawyehsu

VOLTA_FEATURE_PNPM=1

I got this working with this export:

❯ pnpm install  WARN  Unsupported engine: wanted: {"node":">=18"} (current: {"node":"v16.20.0","pnpm":"8.6.2"}) Lockfile is up to date, resolution step is skipped Already up to date

[email protected] prepare /Users/theo.despoudis/Workspace/datree husky install

husky - Git hooks installed Done in 1.2s ❯ export VOLTA_FEATURE_PNPM=1 ❯ pnpm install Lockfile is up to date, resolution step is skipped Already up to date

[email protected] prepare /Users/theo.despoudis/Workspace/datree husky install

husky - Git hooks installed Done in 1.1s

theodesp avatar Dec 04 '23 14:12 theodesp

I also experience the same issue with the [email protected] and [email protected].

The project has declared the [email protected], shown in the picture below, with node -v. While executing the pnpm node -v, the node version used was [email protected], which was the node version used when installing the pnpm.

Let's say we run the NextJS project with the pnpm dev; then the node version is attached to the pnpm, not the one declared in the project itself.

I have also tried adding the global environment variable stated in https://docs.volta.sh/advanced/pnpm; it looks like the feature is still experimental.

I would appreciate it if someone could help with this issue; thank you!

image

malfianrasyidin avatar Jan 17 '24 07:01 malfianrasyidin

I also experience the same issue with the [email protected] and [email protected].

The project has declared the [email protected], shown in the picture below, with node -v. While executing the pnpm node -v, the node version used was [email protected], which was the node version used when installing the pnpm.

Let's say we run the NextJS project with the pnpm dev; then the node version is attached to the pnpm, not the one declared in the project itself.

I have also tried adding the global environment variable stated in https://docs.volta.sh/advanced/pnpm; it looks like the feature is still experimental.

I would appreciate it if someone could help with this issue; thank you!

image

You are using volta v1.0.5 while the VOLTA_FEATURE_PNPM feature support was introduced in Volta v1.1.1...

chawyehsu avatar Jan 17 '24 09:01 chawyehsu

I also experience the same issue with the [email protected] and [email protected]. The project has declared the [email protected], shown in the picture below, with node -v. While executing the pnpm node -v, the node version used was [email protected], which was the node version used when installing the pnpm. Let's say we run the NextJS project with the pnpm dev; then the node version is attached to the pnpm, not the one declared in the project itself. I have also tried adding the global environment variable stated in https://docs.volta.sh/advanced/pnpm; it looks like the feature is still experimental. I would appreciate it if someone could help with this issue; thank you! image

You are using volta v1.0.5 while the VOLTA_FEATURE_PNPM feature support was introduced in Volta v1.1.1...

You are right, @chawyehsu, thank you. The docs should have mentioned the minimum version of the Volta itself.

malfianrasyidin avatar Jan 23 '24 04:01 malfianrasyidin

I had the same issue even with Volta v1.1.1 and VOLTA_FEATURE_PNPM flag enabled, but managed to fix it by uninstalling pnpm and installing it again while node 20.11.0 was pinned.

So just:

volta uninstall pnpm
volta pin [email protected]

( or volta install [email protected] to have it as a default node version )

volta install pnpm

And now this command finally tells me that pnpm uses my desired node version:

pnpm node --version
> 20.11.0

olja-ivkovic avatar Mar 11 '24 10:03 olja-ivkovic

Seeing this too. The uninstall/reinstall workaround works for me.

mfwgenerics avatar Jun 11 '24 18:06 mfwgenerics