nvm icon indicating copy to clipboard operation
nvm copied to clipboard

Support for Custom Patches and Environment Files in nvm

Open fraxgut opened this issue 1 year ago • 2 comments

I am using an experimental Gentoo setup with LLVM/Clang as the default compiler and without GCC. In this environment, I have encountered some issues while trying to use different versions of Node.js with nvm.

To make Node.js versions work correctly in such environments, it would be extremely helpful if nvm supported the application of custom patches. I would like to propose the implementation of a patch directory, perhaps located at .nvm/patches/${patchname}.patch, where users could place patches to address compatibility issues specific to their environment.

Additionally, having an environment file, such as .nvm/env, would be beneficial. This file would allow users to define custom environment variables like CC=clang++ and CXX=clang++, which would be automatically sourced by nvm when switching between Node.js versions. This would simplify the process and make it more expeditious for users in similar situations.

I understand that this feature may be applicable to only a few situations, but I believe it could greatly assist users working with non-standard setups, particularly those utilizing LLVM/Clang as the primary compiler without GCC.

While I recognize that this request is not urgent, I believe that implementing these features could not only resolve my own challenges, but also help others facing similar issues in the future.

fraxgut avatar May 19 '23 18:05 fraxgut

I'm concerned about the dangers of supporting this more directly - node (like all software) should only be used unchanged from how the maintainers released it. Patching software is a fast path towards bugs and security vulnerabilities.

ljharb avatar May 19 '23 19:05 ljharb

I will say that scoping the feature request to "install-specific env variables" makes it much more reasonable, since then it's up to node what hooks it provides.

ljharb avatar May 19 '23 19:05 ljharb