Closed
Description
Sorry, I'm sure this is a duplicate, but I can't find anything in the miriad of issues. I'm running on Ubuntu 14.04, nvm version 0.23.3, and I just recently installed nvm. I used to be on n
but I switched here in order to try out iojs, so it's possible that some residual n
is conflicting with nvm. I removed all the node versions with n
except 0.12.0, uninstalled n
, installed nvm
, and I properly sourced nvm as mentioned in issue #394. Then I ran into the following issue:
$ nvm current
v0.12.0
$ nvm install 0.10
######################################################################## 100.0%
Now using node v0.10.36
$ nvm current # NOTE: didn't change
v0.12.0
$ node -v
v0.12.0
$ nvm use 0.10
Now using node v0.10.36
$ nvm current
v0.12.0
$ node -v
v0.12.0
$ nvm install iojs
######################################################################## 100.0%
WARNING: checksums are currently disabled for io.js
Now using io.js v1.2.0
$ nvm current
iojs-v1.2.0
$ node -v # NOTE: didn't change AND different from nvm current
v0.12.0
This all works just fine when run in sudo su
, but when I exit that shell, it doesn't permeate.
More possible clues:
$ nvm run 0.10 -v
Running node v0.10.36
v0.12.0
$ nvm exec 0.10 node -v
Running node v0.10.36
v0.10.36
$ nvm run iojs -v
Running io.js v1.2.0
v1.2.0
Not sure how to proceed.
Activity
ljharb commentedon Feb 12, 2015
nvm use
isn't meant to persist - it's only for the lifetime of the shell.You can either do
nvm alias default node
if you want that to be the default when opening new shells, or, you can make a.nvmrc
file that will take precedence anywhere in the current directory, upwards to/
.YourDeveloperFriend commentedon Feb 12, 2015
I don't understand. It's not persisting at all, let alone for the lifetime of the shell. Please read the issue again:
This is all one shell:
You may have been confused by this comment:
In other words, it works as intended within sudo, but not in my regular shell.
ljharb commentedon Feb 13, 2015
Ah, sorry, responding too quickly :-)
What does
which node
,echo $PATH
,which iojs
, andnpm root -g
report at all those steps?ljharb commentedon Feb 13, 2015
Also, how did you install
nvm
? (Note that homebrew is not supported or recommended)Under what user did you install
nvm
? (nvm
must be installed once for each user account you want to use with it; it's not meant for being shared across accounts)YourDeveloperFriend commentedon Feb 13, 2015
I installed nvm via my one user: yourdeveloperfriend. I installed with the install script:
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
- I'm on Ubuntu 14.04. I don't have any other user accounts.YourDeveloperFriend commentedon Feb 13, 2015
And don't worry about closing the issue too quickly, I understand you guys probably have a lot of garbage to sort through. Thanks for your help.
ljharb commentedon Feb 13, 2015
@YourDeveloperFriend When you're in the above situation (where 0.10 and 0.12 are installed, 0.12 is active, and
nvm use 0.10
doesn't seem to have any effect), what happens if you donvm deactivate
and then checkwhich node ; node -v
?YourDeveloperFriend commentedon Feb 13, 2015
ljharb commentedon Feb 13, 2015
This is very confusing :-) so, when you start with
nvm deactivate
, yourPATH
should be such thatnvm current
reports "system" (ie,/usr/local/bin/node
). From there,nvm use iojs
for example should activate the latestio.js
version, and yourPATH
should be such thatnvm current
andnode -v
report thatio.js
version, and so on. From there,nvm use 0.10
should remove theio.js
path from yourPATH
, and then add the 0.10 version to it, and thennvm current
andnode -v
should report the 0.10 version.The only thing I can thing of is that somewhere in that chain, the
PATH
changes aren't happening - either the removal, or the addition.What's the output of
alias
? Just want to make certain that you don't have any builtins aliased - even though we usecommand
internally for most of them to bypass aliases.YourDeveloperFriend commentedon Feb 13, 2015
That was it! I had an alias in my
.bashrc
setting node='nodejs'. I think I remember needing to put that in there when I first installed nodejs... But why? I guess this has nothing to do withnvm
. Thanks!ljharb commentedon Feb 13, 2015
ah HA! Yay, thanks for working through it with me!
If you originally installed
node
viaapt
, the default Ubuntu package is called "nodejs", so I suspect that's the origin.YourDeveloperFriend commentedon Feb 13, 2015
So should I uninstall
node
viaapt
? I feel uncomfortable about there being two versions of node on my system, that may be confusing in the future...55 remaining items