node:安装nvm

一,官网地址:

https://nodejs.org/zh-cn/download/

如图:

image

二,安装nvm

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16631  100 16631    0     0  25674      0 --:--:-- --:--:-- --:--:-- 25665
=> Downloading nvm from git to '/home/liuhongdi/.nvm'
=> hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /home/liuhongdi/.nvm/.git/
=> Compressing and cleaning up git repository

=> nvm source string already in /home/liuhongdi/.bashrc
=> bash_completion source string already in /home/liuhongdi/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

load nvm

$ \. "$HOME/.nvm/nvm.sh"

查看效果:

 
$ env | grep NVM
NVM_INC=/home/liuhongdi/.nvm/versions/node/v22.20.0/include/node
NVM_DIR=/home/liuhongdi/.nvm
NVM_CD_FLAGS=
NVM_BIN=/home/liuhongdi/.nvm/versions/node/v22.20.0/bin
$ nvm --version
0.40.3

 

posted @ 2026-02-03 16:34  刘宏缔的架构森林  阅读(6)  评论(0)    收藏  举报