[Node]

Node.js环境安装配置手册

Debian系统安装Node.js

依次执行下列四步命令:

apt update && apt install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

更新软件:apt update

安装Node.js:apt install nodejs -y

验证安装:

node -v
npm -v

设置国内源

设置淘宝镜像源:npm config set registry https://registry.npmmirror.com

验证安装:npm config get registry

回归官方源:npm config set registry https://registry.npmjs.org

作者:ossdate  创建时间:2024-10-29 21:31
最后编辑:ossdate  更新时间:2024-10-29 23:07