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

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

Open
spa5k opened this issue May 11, 2022 · 8 comments

Comments

@spa5k
Copy link

spa5k commented May 11, 2022

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.

@dornfeder
Copy link

dornfeder commented May 12, 2022

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.

@spa5k
Copy link
Author

spa5k commented May 15, 2022

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

@spa5k spa5k changed the title Automatically add the current default nodejs version to the PATH variable in windows. Feature Request: Automatically add the current default nodejs version to the PATH variable in windows. May 15, 2022
@dornfeder
Copy link

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. :)

@JohyC
Copy link

JohyC commented May 17, 2022

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

@BryanAdamss
Copy link

get same problem in Git hooks

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

@segevfiner
Copy link

This will be a problem for any GUI application that ends up invoking Node.js and is not started from a shell with fnm activated, e.g. Visual Studio. Would be cool to have a way to handle that cleanly...

@Schniz
Copy link
Owner

Schniz commented Sep 30, 2024

friendly reminder than in scripts you can do fnm exec --using="version of choice" [your command here]

i have ideas on how to solve that. would not solve all issues, but node etc will certainly work. but... no time: i have family, work, and other side projects.

if one of you have ideas on how to solve this and can put some effort and time (after describing their idea and getting :checked: approved) it would be lovely

@segevfiner
Copy link

Tried that. But I hit #1054. And in my case this is some command embedded inside some other project which needs to work for users who install Node.js in other ways.

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

6 participants