fnm icon indicating copy to clipboard operation
fnm copied to clipboard

Feature Request: Automatically add the current default nodejs version to the PATH variable in windows.

Open spa5k opened this issue 2 years ago • 4 comments

Although we can simply add fnm execution script into the powershell, but since its not available in the path directory, we can not use it during other process, for example, git bash, git hooks. And have to do weird hooks in order to make fnm work there.

I don't think it will be that difficult to add both fnm, the current default node js version and default npm version into the path.

https://github.com/coreybutler/nvm-windows/blob/5803c4f8c7766c670996fbce3fc113a9b0d95050/src/nvm.go#L516

The nvm-windows is trying to do something like that here.

spa5k avatar May 11 '22 13:05 spa5k

I had a similar problem, especially with the Git Hooks. My solution for this was to add the symlink folder for the default alias to the PATH environment variable in Windows:

C:\Users\my-username\.fnm\aliases\default

That way, in an environment where fnm is not set up, like git hooks , or git bash in your case, the default node and npm versions are available. And when fnm is set up, it will override the PATH according to the fnm setup.

You can do this with any alias you like, of course. Doesnt have to be the default.

Hope this helps.

dornfeder avatar May 12 '22 09:05 dornfeder

I can do that, but my point was to make it a automatic feature into the FNM, i should have rephrased my sentence.

spa5k avatar May 15 '22 08:05 spa5k

I can do that, but my point was to make it a automatic feature into the FNM, i should have rephrased my sentence.

Sure that would be nice to have, but in the meantime i just wanted to leave this workaround here so that people with similar problems don't have to struggle as much as I did. :)

dornfeder avatar May 16 '22 06:05 dornfeder

this Feature Request is good idea! in now I can`t use node in systemctl; i need this feature ... image

JohyC avatar May 17 '22 02:05 JohyC

get same problem in Git hooks

.git/hooks/pre-commit: line 14: node: command not found

BryanAdamss avatar May 17 '23 10:05 BryanAdamss