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

Make a symbolic link to directory of current version of node #734

Closed
zodiacg opened this issue Apr 19, 2015 · 5 comments
Closed

Make a symbolic link to directory of current version of node #734

zodiacg opened this issue Apr 19, 2015 · 5 comments
Labels
feature requests I want a new feature in nvm!

Comments

@zodiacg
Copy link

zodiacg commented Apr 19, 2015

Feature request.

Is it possible to make a symbolic link to directory of current version of node?
For example, ~/.nvm/current --> ~/.nvm/versions/node/0.12.2/. It's really useful for OSX users using GUI applications.

nvm works perfect under command line. But it's difficult to setup environment variables for GUI applications under OSX. Before Yosemite, we can use /etc/launchd.conf. In Yosemite, we have to use a more complicated method (see Stack Overflow).
In both methods, it requires a reboot or restart of GUI application to for EV's changes to take effect.
nvm now changes $PATH when changing versions of node. The changes won't take effect for GUI applications.

My solution now is:
I created a symbolic link to the directory of current version of node, like ~/.nvm/current. Then I add Users/XXX/.nvm/current/bin to $PATH for GUI applications. When changing versions, I changes the symbolic link. So the version change will take effect immediately for GUI applications.

Here's a example.
image

IMHO, it also makes $PATH looks nicer.

@ljharb ljharb added the feature requests I want a new feature in nvm! label Apr 19, 2015
@ljharb
Copy link
Member

ljharb commented Apr 19, 2015

Nope, this doesn't make any sense for nvm. nvm is for having different node versions in multiple shell sessions at the same time - a symlink totally breaks this.

IDEs simply can't work well with it unless they can invoke a shell session and source nvm.sh themselves. For that, you want n or a normal system-installed node.

@ljharb ljharb closed this as completed Apr 19, 2015
@zodiacg
Copy link
Author

zodiacg commented Apr 19, 2015

No, I'm not suggesting changing the basic mechanism of nvm. I'm suggesting adding the symbolic link, not setting $PATH to it.
nvm can add a subcommand to manage the symlink. GUI applications will benefit from this for it will make version changes without restart the app possible.

@ljharb
Copy link
Member

ljharb commented Apr 19, 2015

This sounds like ln -s ~/.nvm/current "$(nvm which 0.10)" might solve it for you without any changes in nvm. Adding nvm commands just to manage ln -s for users seems like it might be overkill?

@zodiacg
Copy link
Author

zodiacg commented Apr 19, 2015

Maybe I'm just too lazy to type more commands every time I use nvm to change versions 😄
I'll try writing a shell function to do the work.

@ljharb
Copy link
Member

ljharb commented Apr 19, 2015

Having a global symlink makes sense, but tying it to nvm use is the thing that's utterly incompatible with nvm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm!
Projects
None yet
Development

No branches or pull requests

2 participants