Skip to content
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

Compatibility Issue between Node.js v16 and pnpm v9 when Using pnpm env Command #527

Open
blazeshomida opened this issue Apr 28, 2024 · 1 comment

Comments

@blazeshomida
Copy link

blazeshomida commented Apr 28, 2024

Description:
I recently encountered a compatibility issue while attempting to utilize the pnpm env command with pnpm version 9 to manage Node.js versions.

Context:
I am currently using pnpm version 9. However, when trying to switch to Node.js version 16 using the command pnpm env use --global 16, I faced an unexpected error. Despite my expectation that the pnpm env command would seamlessly handle version switching, it seems there's an compatibility issue between pnpm version 9 and Node.js version 16.

Error Encountered:
Executing pnpm env use --global 16 resulted in the following error message on subsequent pnpm commands:

ERROR: This version of pnpm requires at least Node.js v18.12
The current version of Node.js is v16.20.2
Visit https://r.pnpm.io/comp to see the list of past pnpm versions with respective Node.js version support.

Resolution Attempted:
In response to the error, I attempted to resolve the issue by installing a separate instance of Node.js thorugh Homebrew (which is what I used to install pnpm) as suggested. However, this workaround goes against the intended purpose of using pnpm env for managing Node.js versions, as it required manual intervention to address the compatibility discrepancy.

Request for Clarification:
I apologize for any oversight on my part and acknowledge that this issue might be attributed to user error, such as not thoroughly considering compatibility before attempting to switch versions. I seek clarification regarding the compatibility between pnpm version 9 and Node.js version 16, particularly concerning the usage of the pnpm env command. Additionally, I am eager to learn if there are alternative resolutions or best practices for managing Node.js versions seamlessly with pnpm version 9, especially for users requiring compatibility with Node.js version 16.

This compatibility issue presents a challenge in maintaining a smooth development environment and may impact others facing similar configurations. I am grateful for any insights or guidance provided to address this compatibility concern effectively.

@sylann
Copy link

sylann commented Oct 9, 2024

(I encountered the same issue after facing build errors while using a pnpm-lock that worked in the past. This is just to add some context, I don't know if this is related.)

Not to repeat what's been said above but, you effectively break your pnpm installation by just innocently asking to use another node version with a builtin pnpm command.

There is no prior warning of incompatibility.

Now in my situation, the first time I encountered the bug, I had no node version installed with pnpm so I was forced to reinstall pnpm entirely.

If you have other versions installed already, you may manually fix the symlinks so they point to a working version.
For example if you have 22.9.0 installed:
(this will only work on linux systems.)

rm ~/.local/share/pnpm/nodejs_current
rm .local/share/pnpm/node
ln -s nodejs/22.9.0 ~/.local/share/pnpm/nodejs_current
ln -s ~/.local/share/pnpm/nodejs/22.9.0/bin/node ~/.local/share/pnpm/node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants