use nvm & oh my zsh keep node version
navalink opened this issue · comments
navalink commented
Expected Behavior
node keep v10.24.0
Actual Behavior
v14.16.1
Steps to Reproduce the Problem
$.prefix = 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; set -e;'
await $node -v
await $nvm use 10.24.0
await $node -v
$ node -v
v14.16.1
$ nvm use 10.24.0
Now using node v10.24.0 (npm v6.14.11)
$ node -v
v14.16.1
Specifications
- Version: zx version 4.2.0
- Platform:macOS m1
Anton Golub commented
Each zx
command spawns its own process, so it does not share its session state. In this situation you can:
export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; nvm use 10;
- use
nvm alias default 10
- await $
nvm use 14 && node -v
navalink commented
Each
zx
command spawns its own process, so it does not share its session state. In this situation you can:* `export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; nvm use 10;` * use `nvm alias default 10` * await $`nvm use 14 && node -v`
this can solve my problem, thanks so much