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
PNPM is (still?) not correctly identifying the node version #5266
Comments
Experiencing the same on macOS and pnpm 7.9.5. Regardless of my |
Experiencing the same on Arch linux and pnpm 7.9.5. Steps to fix :-
output:
Fixed the issue for me. |
experiencing the same issue in macOS and pnpm 7.11.0. the above setting fixed it. |
I also had this issue
Fixed the issue by running |
The same happened to me on pnpm v7.26.0. I am on Manjaro Linux. I must have had node v14 installed via nvm at some point. Setting the exact node version in .npmrc helped. Installing pnpm -g also helped. |
The same happened in windows on pnpm v7.26.0. And can't run pnpm add -g pnpm. |
Using Gentoo, had this issue with both the repository node ( Running |
This is the only correct answer which finally worked in my project |
|
I doubt this is the case, as I have never installed Node v14.19.2 (or a version close). That, and it seems as though a lot of people have experienced this issue randomly - it's extremely unlikely that everyone had exactly Node v14.19.2 when they installed |
I had the same issue when I had pnpm installed through volta. After uninstalling it and following the regular pnpm install from the website it worked again. |
none of these solutions worked for me, I ended up simply installing the right node version on my machine with |
I had to do a number of things to get this working. Disabled Also set in the I was working in a monorepo and the problem was only for packages that did not have an Hope that helps. Thanks for all the suggestions my missing piece was the npmrc change. pnpm v8.1.1 |
Also running into something like this when trying to have pnpm coexist with volta. While having pnpm manage the node version is a noble mission, it seems that the existence of the (what should be optional) feature is somehow making things more complex instead of less... :( More details: Running While adding a specific node version in .npmrc file does tell pnpm which pnpm-managed version to use, I do not think this should be a requirement. From the behaviour above, it seems that pnpm is trying to fallback to whatever version is running locally, and while that seems reasonable, it seems to be somehow resolving the version that is running during install. (sidenote - re-running |
Helper that force updates the node version by env() {
echo "will set node and pnpm to v$1"
echo "use-node-version=$1" >> .npmrc
nvm use "$1"
pnpm env use --global "$1"
pnpm add -g pnpm
} |
Not everyone uses
|
I'm trying to deploy to GCloud App Engine and getting the same issue. Neither of these proposed solutions would work there, would they? Has someone been able to solve this without adding |
Noting I had this happen. I originally installed pnpm on node 16 then jumped to node 18 with |
What does the following output: |
The bin file #!/usr/bin/env node
const [major, minor] = process.version.slice(1).split('.')
const COMPATIBILITY_PAGE = `Visit https://r.pnpm.io/comp to see the list of past pnpm versions with respective Node.js version support.`
// We don't use the semver library here because:
// 1. it is already bundled to dist/pnpm.cjs, so we would load it twice
// 2. we want this file to support potentially older Node.js versions than what semver supports
if (major < 16 || major == 16 && minor < 14) {
console.log(`ERROR: This version of pnpm requires at least Node.js v16.14
The current version of Node.js is ${process.version}
${COMPATIBILITY_PAGE}`)
process.exit(1)
}
global['pnpm__startedAt'] = Date.now()
require('../dist/pnpm.cjs')
// if you want to debug at your local env, you can use this
// require('../lib/pnpm') |
Modify that file and add pnpm usually runs from a bin stub shell script for me...I found that earlier versions hard-coded the node version. You should also check if you use This script is usually at |
And script to check this real quick when upgrading
You will probably want to clean up those pnpm packages so either uninstalling node or removing Outputs
Both should output the NODE_VERSION on the top. Though for me I think I was messing around with |
I don't see a problem with that output... |
I'm seeing this problem while using PNPM I see no mention of the older Node version being activated by PNPM in the logs, but it still is resolving to the wrong version. As a workaround, I've disabled the Logs
|
Thanks so much @biro456 and @paro-paro! I had this exact same issue. I've uninstalled nvm, pnpm, all versions of node from all package managers and it still didn't work. Then I commented out I am on pnpm 8.11.0 The error I get when having
The only Node version I have currently is 20.10.0, and it is installed with $ pnpm env list
20.10.0 |
The answer from @vjpr works for me. I use $ sudo n lts
copying : node/20.10.0
installed : v20.10.0 to /usr/local/bin/node
active : v18.8.0 at /Users/captainofphb/Library/pnpm/node
$ node -v
v18.8.0
$ which node
/Users/captainofphb/Library/pnpm/node After I removed $ pnpm env list
18.8.0
$ pnpm env remove --global 18.8.0
Node.js 18.8.0 was removed
/Users/captainofphb/Library/pnpm/nodejs/18.8.0
$ node -v
v20.10.0
$ which node
/usr/local/bin/node Good! |
Have exact same issue:
running on Windows if that matters, using nvm-windows but this also happened when i installed node manually. Path to node is set properly and node is usable everywhere besides pnpm. |
i had this issue some time ago and the reason was ( in my case ) that somehow I had the $PATH variable containing the entry of different node installation rather than the nvm I was using. the solution wasn't obvious so it took a while to find out. my take on this is that if you use pnpm to manage node version AND something else, don't. Use only one. I chose nvm, not perfectly happy with it but it does the job |
It's not that easy. pnpm didn't work with just |
@zkochan Could you please explain how/where pnpm finds the node version it uses? I have the same issue as others, i.e. that pnpm expected a certain version (the one I listed in PS 1: I am developing in a vscode devcontainer where node was installed via an nvm script, then pnpm installed via curl. PS 2: I checked out my PATH variable, and it does not contain that old outdated node version which pnpm seems to use. PS 3: This folder does not exist on my machine: PS 4: Adding
I have no idea what is meant by the above. There are no cross-device links here. The project is one monorepo. If we knew where pnpm found that old node version it uses, and directed it to look elsewhere (like via $PATH), then perhaps we could solve this quickly. |
Hit the same issue today. Only had time to look into possible root-cause briefly. My guess is that the culprit is
The release binaries seemingly bundle nodejs 18.5.0 1 as their runtime to bootstrap pnpm by means of the deprecated @vercel/pkg packager. The above mentioned check may be failing (might be worth trying to check for process.pkg !== undefined instead?) and the version being returned is the bundled nodejs version 18.5.0, not the system node version in your environment's PATH .
This is why the issue goes away when you install via Footnotes
|
In case it helps, here's a reproduction on github actions. UPDATE: scratch that, I noticed it was using pnpm 8.3.1. Upgrading to 8.15.1 makes it work now as you can see from the build. However, I have 8.15.1 on an identical project, and that doesn't work, so now I'm baffled. UPDATE 2: Well, after trying to figure this out for a while now, my other project build is now passing, I'm guessing that rerunning on github actions didn't cause pnpm to update, somehow, even though I can't imagine how it caches an older version since I'm enabling corepack each run. No idea, but this is all now working for me. Hopefully it holds. |
I'm now on pnpm 8.15.2 It's been working for a while, but I recently added Next.js to our monorepo and the issue reappeared. % pnpm install
Scope: all 3 workspace projects
Lockfile is up to date, resolution step is skipped
ERR_PNPM_UNSUPPORTED_ENGINE Unsupported environment (bad pnpm and/or Node.js version)
Your Node version is incompatible with "/next/14.1.0(react-dom@18.2.0)(react@18.2.0)".
Expected version: >=18.17.0
Got: v18.5.0
This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.
% which node
~/.nvm/versions/node/v20.11.0/bin/node
% node -v
v20.11.0 |
FWIW I'm running into the same issue when using the install script from the installation section. If PNPM is installed through the install.sh and I run However if I install pnpm through homebrew it will infer my node version based on what version nvm is on. I do not have a version that is even remotly close to 18.5.0 installed on my system and I also have no idea where pnpm is pulling that from. OS: Mac OS Sonoma (14.3.1) tldr; Try installing it through homebrew if you're using macos. |
I want to point out that many of us are getting the same exact Node version mentioned by pnpm:
Earlier versions of pnpm seem to be "locked" to an exact 14.x.x version if you look at comments further back. I'm on macOS and I'm using |
I explained why that is a few comments up: #5266 (comment) TL;DR: pnpm comes bundled with 18.5.0 when installed through the convenience script. |
pnpm version:
7.9.5
Code to reproduce the issue:
pnpm install
Expected behavior:
installation proceeds as normal
Actual behavior:
ERR_PNPM_UNSUPPORTED_ENGINE Unsupported environment (bad pnpm and/or Node.js version)
Additional information:
node -v
prints:Windows 10
This is the same issue as #4203 and was either never fixed or has regressed.
This can be reproduced by downloading the 7.9.5 version from github releases and running pnpm install twice. See attached console log
The text was updated successfully, but these errors were encountered: