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

n for each user? #277

Closed
bigdx opened this issue May 20, 2015 · 10 comments
Closed

n for each user? #277

bigdx opened this issue May 20, 2015 · 10 comments

Comments

@bigdx
Copy link

bigdx commented May 20, 2015

Hi,

My users (not su/root!) should be able to select their "own" node-version, for the current user (or current directory) only, NOT globally. Maybe I just messed up something, but I cant get that work. I have added "export N_PREFIX=$HOME" to .bash_profile and can install "local" (for current user) node-versions with "n VERSION" (to $HOME/n/version...), using "n" even switch them (without any error), but that has no effect at all: node -v still returns the same version (set by root)...

"n use ... -v" or "N_PREFIX=$HOME n use ... -v" (without export) seems to work so ...

What am I doing wrong?

@bigdx
Copy link
Author

bigdx commented May 20, 2015

I installed n with the recommanded method "npm install -g n". OS is CentOS7. Globally n works like a charme...

@ghost
Copy link

ghost commented May 20, 2015

I don't know how CentOS sets up the shell path. I know with Linux Mint and Ubuntu that .profile adds ~/bin to the front of the PATH if it is present. When running n from the user's home folder, it will install node/io to ~/bin.

Just make sure ~/bin is at the beginning of your PATH so it uses that node and not the version down in /usr. Where does it point when you run which node?

@bigdx
Copy link
Author

bigdx commented May 20, 2015

$ which node
/usr/local/bin/node

I see, points to the "gobal" node. How do i change that so the "currently by n set" node-version is used?

/bin is included in the PATH (PATH=$PATH:$HOME/.local/bin:$HOME/bin) already, so thats not the problem.

There needs to be a "local n" , but how? With "npm install n"? After that
$ which n still points to /usr/bin/n

To which "bin" PATH has to point?

@ghost
Copy link

ghost commented May 20, 2015

When you run echo $PATH ~/bin needs to be at the front of all other bin folders. It looks like your ~/bin is at the end?

Having N_PREFIX exported to $HOME for each user is correct. When n installs or activates a version, it will copy the node run time to bin folder under the directory of N_PREFIX.

Also, please keep you question to a single issue.

@bigdx
Copy link
Author

bigdx commented May 21, 2015

Thx! Ok then, i'll try a differnt order of PATH, beginning with $HOME/bin ... where /bin does not exist yet ...

"Also, please keep you question to a single issue." Im not sure what you mean? My questions (as posts) in other issues (as threads) have nothing to do with each other ... at least I dont see any connection ... well, ok, all about n, right ^^ ... wouldn't be bad practice to mix different topics in one issue though? But maybe I just didn't get what you means ...

@ghost
Copy link

ghost commented May 21, 2015

I saw your comments in other issues. They appeared to be asking the same as what you described in this issue. Sorry if I read it wrong.

@bigdx
Copy link
Author

bigdx commented May 22, 2015

No Problem. But you are right in some way ... the problem all my questions based on, was in the end the same or at least related, but I didn't knew that at time of writing... Chicken/Egg-Problem at its best ^^

@maxrimue
Copy link
Contributor

@bigdx Is your problem solved now?

@bigdx
Copy link
Author

bigdx commented Jun 2, 2015

@maxrimue yes, solved (sorry, had some days off)

@tedgaydos Thx, changing the order of PATH worked. So if somebody has a similar problem, the .bash_profile looks somewhat like this now ...

$ nano ~/.bash_profile
   # ...

   # Changed PATH order, with §HOME/bin at the beginning, ahead of /usr/local/bin/
   PATH=$HOME/.local/bin:$HOME/bin:$PATH
   export PATH 

   # Add n prefix
   export N_PREFIX=$HOME

@maxrimue
Copy link
Contributor

maxrimue commented Jun 2, 2015

@bigdx Good, I'll close this now then

@maxrimue maxrimue closed this as completed Jun 2, 2015
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

2 participants