nvm
nvm copied to clipboard
when reopen terminal and node\npm\yarn are not available
Operating system and version:
macOS 13.1
nvm debug
output:
~ %npm
zsh: command not found: npm
~ %
nvm ls
output:
~ %nvm ls
v16.13.2
default -> 16.13.2 (-> v16.13.2)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.13.2) (default)
stable -> 16.13 (-> v16.13.2) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.2 (-> N/A)
lts/gallium -> v16.19.0 (-> N/A)
lts/hydrogen -> v18.12.1 (-> N/A)
How did you install nvm
?
install script in Homebrew
What steps did you perform?
install nvm and node in one zsh window and use npm in another zsh window
What happened?
~ %npm
zsh: command not found: npm
~ %
What did you expect to happen?
show the npm help scripts
Is there anything in any of your profile files that modifies the PATH
?
no
(note that installing nvm via homebrew is unsupported; please install it with the only proper method, the install cript in the readme)
Once nvm is installed, you need to close and reopen your terminal to use it (or, open a new one). At that point, nvm
is installed, but node
and npm
are not - you need to nvm install node
(or nvm install 12
, or whatever) first.
yarn does not ship with node and would only be available if you installed it yourself.
solved this issue by reset PATH:
export PATH=$PATH:/Users/leo/.nvm/versions/node/v16.13.2/bin
@liuzongyang255 that's not solving it, and that's going to guarantee nvm can't work properly. nvm alias default 16
would be sure it's set as the default, though.
This command solves my problem nvm alias default 16
where 16
can be replaced by the desired version like 16.19.0
or another.
This seems answered.