Skip to content

fix: provide HOME env for node version manager compatibility #16362

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zetavg
Copy link

@zetavg zetavg commented Jun 15, 2025

Summary

asdf version manager shims requires $HOME to be set for finding the correct thing to execute.
See: #16361

Related Linear tickets, Github issues, and Community forum posts

Resolves #16361

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@CLAassistant
Copy link

CLAassistant commented Jun 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic reviewed 1 file and found no issues. Review PR in cubic.dev.

@n8n-assistant n8n-assistant bot added community Authored by a community member core Enhancement outside /nodes-base and /editor-ui labels Jun 15, 2025
@Joffcom
Copy link
Member

Joffcom commented Jun 15, 2025

Hey @zetavg,

Thanks for the PR, We have created "GHC-2556" as the internal reference to get this reviewed.

One of us will be in touch if there are any changes needed, in most cases this is normally within a couple of weeks but it depends on the current workload of the team.

@n8n-assistant n8n-assistant bot added the in linear Issue or PR has been created in Linear for internal review label Jun 15, 2025
@Joffcom
Copy link
Member

Joffcom commented Jun 15, 2025

Hey @zetavg

Don't forget to add tests for this to be considered.

Personally I think the issue is more like to be with asdf if common install options don't work.

@zetavg
Copy link
Author

zetavg commented Jun 16, 2025

Hey, thanks for looking into this.

I think this change is simple, it’s just some version managers will install node under the user’s home dir, with shims being global, so they require the $HOME environment variable to be set to find the correct install.

Therefore, in the child process executing npm commands, forwarding the $HOME environment variable is needed for these kinds of version managers to work, just like $PATH is being passed there.

With my understanding, nvm works because it shims by modifying $PATH, so passing just $PATH is enough.

But other package manager implementations, such as Volta and asdf (or also mise? not sure), creates real binary shims in a globally persistent location (which some people find it cleaner and more robust than nvm's shell hacks), but they may require the $HOME env to be set correctly to work.

What level of tests do you think we should add, integration tests that test if it works under various version managers, or unit tests that verify $HOME is set when the commands are executed? But both I think the test won’t be easy to implement, so it’s probably fine to go without regression tests.

Btw the only tiny concerns I can think of for now are:

  • Will it break nvm? - Don't think so, since in most scenarios that nvm runs,$HOME is being set anyway.
  • Security concerns? - I think $HOME location isn't so sensitive, and the commands being run seems to be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community nodes page error: "Problem fetching installed packages" "Unexpected end of JSON input"
3 participants