1

I am working on some remote linux server, where I want to set node v8.0.0. But it seems this has been set to use v0.10.35 and how much ever I try to use nvm use and set different node version, it doesn't work.

Here are the simple code and output:

jk@:$ nvm debug
nvm --version: v0.32.0
$SHELL: /bin/bash
$HOME: /home/jk
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: system
which node: /usr/bin/node
which iojs: which: no iojs in (/data/thirdparty/gcc-6.1.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin)
which npm: /usr/bin/npm
npm config get prefix: Error: ENOENT, stat '$NVM_DIR/versions/node/v8.0.0'
npm root -g: $NVM_DIR/versions/node/v8.0.0/lib/node_modules

jk@:~$ nvm list
         v6.1.0
         v6.6.0
         v8.0.0
->       system
default -> v8.0.0
system -> 8.0.0 (-> v8.0.0)
node -> stable (-> v8.0.0) (default)
stable -> 8.0 (-> v8.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.8.7 (-> N/A)
lts/boron -> v6.12.2 (-> N/A)
lts/carbon -> v8.9.3 (-> N/A)
jk@:~$ node -v
v0.10.35
jk@:~$ nvm use 8.0.0
Now using node v8.0.0 (npm v1.4.28)
jk@:~$ node -v
v0.10.35

I checked my ./bashrc file etc, but completely clueless why nvm use doesn't working and which file is actually overwriting this.

kaounKaoun
  • 601
  • 1
  • 9
  • 21
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Dec 17 '17 at 21:14
  • [How do I clear Bash's cache of paths to executables?](https://unix.stackexchange.com/q/5609/56041), [How to get bash to automatically refresh program locations' cache?](https://superuser.com/q/733744/173513), [What is the purpose of the hash command?](https://unix.stackexchange.com/q/86012/56041), etc. You might also be interested in [Check if a program exists from a Bash script](https://stackoverflow.com/q/592620/608639) and [How to check if command exists in a shell script?](https://stackoverflow.com/q/7522712/608639) – jww Dec 17 '17 at 21:15

1 Answers1

4

(nvm maintainer here)

The npm config get prefix error in nvm debug is concerning; you may want to try nvm uninstall 8 && nvm install 8.

If you’re still having trouble, please file an issue on the git repo http://nvm.sh

LJHarb
  • 32,486
  • 2
  • 32
  • 38
  • 2
    In my case, uninstall didn't work because default still pointed to before version so I had to use __nvm alias defaulr __ – Hector Aug 30 '20 at 21:06