pnpm: PNPM is not using the node version set via pnpm env use
pnpm version: 6.25.0
Code to reproduce the issue:
.npmrc
engine-strict = true
Slice of package.json
"engines": {
"node": ">=16"
},
❯ pnpm env use --global 16
Node.js 16.13.1 is activated
/Users/stickb/Library/pnpm/node -> /Users/stickb/Library/pnpm/nodejs/16.13.1/bin/node
❯ pnpm i
ERR_PNPM_UNSUPPORTED_ENGINE Unsupported environment (bad pnpm and/or Node.js version)
Your Node version is incompatible with "/Users/stickb/Code/green-boost".
Expected version: >=16
Got: v14.18.2
This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.
❯ node -v
v16.13.1
Expected behavior:
pnpm should use version of node that it set
Actual behavior:
pnpm uses another version of Nodejs
Additional information:
node -v
prints: 16.13.1- Windows, macOS, or Linux?: macOS
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 21
- Comments: 28 (5 by maintainers)
Commits related to this issue
- fix: do not set a default value for node-version ref https://github.com/pnpm/pnpm/issues/4203#issuecomment-1133872769 — committed to pnpm/npm-conf by zkochan 2 years ago
- fix: correctly detect the active Node.js version ref #4203 — committed to pnpm/pnpm by zkochan 2 years ago
- fix: correctly detect the active Node.js version (#4780) close #4203 — committed to pnpm/pnpm by zkochan 2 years ago
- fix: correctly detect the active Node.js version (#4780) close #4203 — committed to pnpm/pnpm by zkochan 2 years ago
- Updated .npmrc in hopes of getting past Vercel deployment error Vercel Error: ERR_PNPM_UNSUPPORTED_ENGINE Unsupported environment (bad pnpm and/or Node.js version) Your Node version is incompatible... — committed to nvlgzr/ouroboros by nvlgzr 2 years ago
@bestickley what happens if you do
pnpm add -g pnpm
after doingpnpm env use --global 16
Sorry, the initial issue was fixed, so you need to create a new issue with exact steps to reproduce.
At the moment, I don’t really have ideas why this doesn’t work (maybe we can add some more debug information to the error message).
Also, I think as a workaround, you may put an
.npmrc
to the root of your project with the following configuration:NOTE: You should use an exact version for this setting.
I think it should still work without running
pnpm i -g pnpm
I had the same issue as @bestickley and I was able to fix it thanks to @PabloSzx comment (thanks 👏 ):
Error:
Environment:
.npmrc
package.json
None of the other solutions here worked for me, but adding this line to my
.npmrc
file did fix it:I experienced this issue right now. After upgrading from node v14 to v16 via
nvm
I was unable to do pnpm install.Got the same error
After doing
pnpm add -g pnpm
I can install dependencies.I’m currently facing this issue
Fixed it for me in my monorepo using Volta.
Seems like the volta node is used at the root, but the global node is used for apps & packages.
use-node-version
seems to force it for everything.@Deebster I see. I was able to reproduce it as well. I’ll look into it.
I did not achieved to solve this issue even if
nvm
was using v16 properly (PNPM complaining about being stuck at node 12). Uninstalled and re-installed it properly with Corepack and now it’s working great.PS: Wasn’t working with a curl reinstall neither (was using node 14 for some reason while I had a
engine
version specified in mypackage.json
)Same here, wonder why
pnpm i -g pnpm
is necessary.pnpm store prune && pnpm i
Same issue for me
~ pnpm add -g pnpm Nothing to stop. No server is running for the store at /home/felix/.local/share/pnpm/store/v3 Already up to date Progress: resolved 1, reused 1, downloaded 0, added 0, done Done in 1.4s
pnpm env use --global 18 Fetching Node.js 18.15.0 ... Node.js 18.15.0 is activated
pnpm install [sudo] password for felix: WARN Unsupported engine: wanted: {"node":">=18"} (current: {"node":"v16.17.0","pnpm":"8.1.0"})
update: this fixed it for me ! https://github.com/pnpm/pnpm/issues/5266#issuecomment-1230366384
The problem is still happening for me on 7.3.0. Had to globally install pnpm after setting the env setting, like @PabloSzx suggested.
today I needed to do this:
corepack enable
corepack prepare pnpm@<version> --activate
pnpm env use --global <version>
thenpnpm i
worked afternpm init svelte my-app
@PabloSzx, this worked! Thank you very much. Documenting output here: